'Is it valid to put a class object in multiprocessing.Process as its argument?

I'd like to create a process like this: multiprocessing.Process(target=function, args=(object)) An object in args, is it valid? Thanks.



Solution 1:[1]

For something to be passed to/between processes in python, it must be "pickleable". See this official documentation page: What can be pickled and unpickled?.

Generally, for classes to be pickleable they must be defined at the top level of the module (the .py file), which is the most common situation.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 blarg