Como executar uma função em intervalo em python
# This runs test() function in intervals of 1 second
from threading import Timer
run = True
def test():
global run
print("something")
if run:
Timer(1, test).start()
test()
# now whenever you set run to False the test function won't run anymore
# and of course if you dont set it to False it will run forever
Jenova