Then, you must put the initialization (dynamically loading the modules) into the function executed in the foreign process.You could wrap the payload function into a class instances to achieve this. In the foreign process, you call the instance which first performs the initialization and then executes the payload.
That's what I have in mind: loading the modules first, and then unpickle and call the real target function. -- https://mail.python.org/mailman/listinfo/python-list