I can't seem to get a function to call itself after a specific time interval using the Threading module as seen in this thread Run certain code every n seconds
when I run a copy of that code:
import threading
def printit():
threading.Timer(5.0, printit).start()
print("Hello, World!")
printit()
It will print "Hello, World!" once (the original call function) and then run endlessly without printing anything new.
I know that the module is installed correctly, because when I run this
import threading
def printit():
print ("Hello, World!")
threading.Timer(5.0, printit).start()
it will wait 5 seconds before printing "Hello, World!" just like it's supposed to. I think the problem lies in Python 3 because the linked Stack Overflow thread, as well as some others that I've looked at, were ll using python 2 and when I tried it on another machine with python 2 it worked. Any insight on why this may be happening or how to fix it would be greatly appreciated.