I am trying to learn multiprocessing in python but it does not work in its very early steps. for example in the code below:
counter = 2
def train_func():
counter1 = counter*2
p1 = mp.Process(target=train_func)
p2 = mp.Process(target=train_func)
p1.start()
p2.start()
p1.join()
p2.join()
print(counter1)
the result is that NameError: name 'counter1' is not defined. It seems that it does not enter the function. what is wrong with that?