I want to run a function for 10s then do other stuff. This is my code using Timer
from threading import Timer
import timedef timeout():b='true'return ba='false'
t = Timer(10,timeout)
t.start()while(a=='false'):print '1'time.sleep(1)
print '2'
I know that using Timer I can print something at the end of the timer (print b instead of return b return true after 10s). What I want to know is : can I get the value returned by timeout() inside "a" to perform my while loop correctly?
Or is there another way to do it with another function ?