I am using a Manager
from pythons multiprocessing
library. I would like to share variables between threads.
So I have a function and this function uses one such variable internally. Because of python's multiprocessing rules, I need to put the Manager
and the variables in if __name__ == '__main__':
. Is there a smart way to still access the variable status
? Code below:
from multiprocessing import Value, Manager
def first_methode():
if status.value:
do_something...
if __name__ == '__main__':
manager = Manager()
recording_status = manager.Value(status, False)
thread = multiprocessing.Process(target=first_methode)
This gives me a
NameError: name 'status' is not defined
Any suggestions? Thanks!