I have a py file with functions that requires multiprocessing, so i do something like this:
pool = Pool()
def function_():
pool.map(...)
Then, I'll import this file into the main one, but when i run function_
I get:
daemonic processes are not allowed to have children
and this is usually due to the fact that multiprocessing will re-run the file where it's called (thus usually the pool has to be inserted in if __name__ == "__main__"
, see here Python multiprocessing gets stuck)... is there a way to avoid this?