I have a Python module `mymodule'
# mymodule.py
import multiprocessing as mp
def do_work(x):
# do some stuff
return 42+x
def work():
pool = mp.Pool()
work_list= [1,2,3,4,5]
returned_values = pool.map(do_work, work_list)
pool.close()
#end mymodule
I want to import this interactively in a Python shell and invoke work()
like this
In [1]: import mymodule as mm
In [2]: mm.work()
If I do this the do_work
does not seem to be doing anything. How can I make this work in an interactive shell. If I turn the above into a non-interactive script I face no problems. I am on Windows.