Scopes and multithreading in python

Hi @koreno

You would need to get Hub.current in the spawning thread and pass it to your child thread. In that thread, wrap your code with:

with Hub(hub_passed):
    # thread code goes here

Automatic inheritance is unfortunately not possible unless we monkeypatch threading.

1 Like