Here's my code:
import multiprocessing as mp
var = 1
def p1func():
global var
var += 1
p1 = mp.Process(target=p1func)
p1.start()
p1.join()
print(var)
the problem occurs when printing var.
(I am quite new to python so i am not that good, so dont be surprised if its something very obvious that i missed.) problem below.
The problem is that the output is 1, even when i made and ran a process to change to 2. Why is this? This code was made to test out multiprocessing for a larger project. I globalled the variable, did p1.join() to make sure the process was complete, but it still dosent work.
Any reasons wold be helpful, thank you.