I have a loop function that should only run when the variable dd is set to 1. I have two other classes that should start and stop it. Start() sets dd to 1 and runs the loop. Stop() sets dd to 0. But the problem is the variable doesn't change from it's original value 0 when Start() is ran or vise-versa if set to 1 to start with.
class Class1(object):
def Function(self, a):
print a
def startProgram(self):
with open('data\blah.txt') as e:
for i in e:
if dd == 1:
self.Function(i)
def Start(self):
dd = 1
self.startProgram()
def Stop(self):
dd = 0