I have such looped functions in this form:
from multiprocessing import Pool
def foo_1(i):
count = 1
for something:
# blah blah blah
h=0
while len()<count:
def foo_2(j):
# blah blah blah
return i + j
h = h+1
count +=1
if __name__ == '__main__':
pool = Pool(4)
pool.imap_unordered(foo_2, range()):
pool.close()
pool.join()
How should the syntax look like to make it work? Because giving if __name__ == '__main __' inside foo_1 does not work, and if I put it at the end, it does not recognize the functionfoo_2. Or maybe you need to completely rebuild the code syntax?
foo_2is a completely different function on each iteration. And, even if you never callfoo_1, you won't be able to access it, as it's defined on "runtime", in the same way you'd not be able to access any other private variable.