I am trying to make my program work offline. The way i decided to to this is to have the main application work from memory in its own thread, whilst another thread read/writes data from the database.
I'm having issues with the variables being referenced before assignment.
import threading
class Data():
global a
global b
a = 1
b = 1
class A(threading.Thread):
def run(self):
while True:
a += 1
class B(threading.Thread):
def run(self):
while True:
print a
print b
b -= 1
a_thr = A()
b_thr = B()
a_thr.start()
b_thr.start()