0

I am trying to pass some certain functions to a distributed system. The system uses serialized data to do such things, ie. it pickle the function by default and send it to destination. Here I have a problem that some complex functions are involving data and functionalities of other modules. Eg., I am to send the func1 which is imported from utils.py in main.py, func1 also uses some lists/dicts in data.py. Such as:

│───main.py    
│
└───module1
    │   __init__.py
    │   utils.py
    │   data.py

The code of utils

import data
def func1(arg):
    return func2(data.cfg, arg)

def func2(*args):
   .....

I tried dill, it however could not recursively process references accross modules. Any solution to cope with serialization?

Varg Nord
  • 33
  • 1
  • 8
  • Does [this](https://stackoverflow.com/questions/10048061/how-to-pickle-a-python-function-with-its-dependencies) answer your question? The question title is almost exactly the same as yours, but I'm not totally sure it's a duplicate as the examples given there seem quite different (perhaps because that question is so old). – BrenBarn Sep 22 '22 at 07:29

0 Answers0