Answer the question
In order to leave comments, you need to log in
Why isn't the thread running?
def _timer():
timer = True
while True:
if timer == False:
time.sleep(60)
timer = True
t1 = threading.Thread(target=_timer)
t1.daemon = True
t1.start()
print("T2 LOADED")
Answer the question
In order to leave comments, you need to log in
I understand the timer variable should change from the outside?
I'm not an expert, but it seems to me that the function does not see the external variable timer.
what can I suggest, I experimented a little, in general - try to wrap the timer variable in an object and pass it to the streams by reference (just pass it).
it worked for me like that. I will attach the screen with an example
code:
result:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question