So, the one missing piece to a complex (for me at least) program I made in python is that I have two variables outside of two functions (both of which funcs I run as processes, and the processes execute concurrently as expected), and the issue I have is both Process functions are altering the exterior (global) variables, yet when I try to get one from the other, it does not get the proper value (in fact, the first function does not receive any change when the other function prints it. I made a really simplified version of this issue to help explain:
from multiprocessing import Process
import time
global n
def func1():
n = False
while True:
print(n)
time.sleep(1)
def func2():
n = False
while True:
n = True
time.sleep(1)
Process(target=func1).start()
Process(target=func2).start()
So, as you see, n is not getting changed (at least not in the func1). Even if it were to get changed I believe that as they run concurrently it would reset back, as the process would call and reset the value, and I'm really not sure how to get around this situation. I do understand scope but everything I had read indicated this was the proper way to declare this, I was confused as well, but did so. What am I missing/what syntax am I incorrectly handling? I'm sure this is a simple question, and apologies for it, but could not find on this site or elsewhere and it's driving me nuts.