Skip to content Skip to sidebar Skip to footer

Python: Running Multiple Timers Simultaneously

I want to create multiple timers in a loop. When the loop terminates, there should be multiple timers running. If any of the timers times out, it should call another function. How

Solution 1:

Look into Timer, which is locate in the threading module of the python standard library. The documentation gives the following example:

from threading import Timer

def hello():
    print("hello, world")

t = Timer(30.0, hello)
t.start() # after 30 seconds, "hello, world" will be printed

Post a Comment for "Python: Running Multiple Timers Simultaneously"