I am currently facing the mentioned error by running a very simple code :
Code:
import multiprocessing as mp
import time as t
def do_something():
t.sleep(1)
print("Done Sleeping")
p1 = mp.process(target=do_something)
p2 = mp.process(target=do_something)
p1.start()
p2.start()
p1.join()
p2.join()
I get
Error: TypeError: 'module' object is not callable
Not sure what really is wrong here. Can you help me understanding what is my mistake?
The Process class needs a capital P to be picked up.
Without the capital you are trying to instantiate the module: multiprocessing.process
.
Try the following:
import multiprocessing as mp
import time as t
def do_something():
t.sleep(1)
print("Done Sleeping")
p1 = mp.Process(target=do_something)
p2 = mp.Process(target=do_something)
p1.start()
p2.start()
p1.join()
p2.join()