I don't know if this is a known issue, but I've run into an issue using scoop/multithreading library. The issue seems to be that I can't pass the toolbox into a function that is being used to multithread.
I think I've narrowed it down to the simplest working example:
```
t = Toolbox()
def test(toolbox: Toolbox, x) -> int:
return x**2
t.register("map", futures.map)
t.register("test", test, toolbox)
if __name__ == "__main__":
print(list(t.map(t.test, [1, 2, 3, 4])))
```
This code fails to run when the run by through `python -m scoop ....` but does work if you run it without using scoop `python ...`
When this fails it returns a rather large error message that ends with
```
raise ReferenceBroken("This element could not be pickled: "
scoop._comm.scoopexceptions.ReferenceBroken: This element could not be pickled: (b'
127.0.0.1:64452', 1
):partial(1,){}=None.
```
I suspect this is because the toolbox can't be pickled.
```
t = Toolbox()
def test(toolbox: Toolbox, x) -> int:
return x**2
t.register("map", futures.map)
t.register("test", test, toolbox)
if __name__ == "__main__":
import pickle
pickle.dumps(t)
```
The above code panics with the following error
```
Traceback (most recent call last):
File "... .py", line 54, in <module>
pickle.dumps(t)
_pickle.PicklingError: Can't pickle <function map at 0x733e05b294e0>: it's not the same object as scoop.futures.map```
Thanks,
Alan