i'm struggling trying to make my thread read variables located outside of it.
Here's the code:
lst = []
class InstancesManager(object):
...
def start_thread(self):
process = multiprocessing.Process(target=self.checker)
process.daemon = True
process.start()
def checker(self):
global lst
while True:
print lst
time.sleep(5)
...
global lst
manager = InstancesManager()
lst.append('foo')
manager.start_thread()
lst.append('bar')
The problem is: thread always prints lst as ['foo'], despite of any changes i performed with it. I tried to save lst as class variable and access like "print self.lst" and "manager.lst.append('bar')" but result is always the same.
How can i make my thread see changes in variables from main program?