threading.Timer()
threading.Timer() is a Python function in the Threading Module category. Creates a timer that runs a function after a specified delay. The syntax is threading.Timer(interval, function, args=None, kwargs=None). Returns: Timer (Thread subclass). A typical example: def alert():
print("Time is up!")
t = threading.Timer(5.0, alert)
t.start() # alert() called after 5 seconds. A close sibling is threading.Thread(), which creates a new thread object that runs the target function with args. A close sibling is thread.Thread.start(), which starts the thread activity. Must be called at most once per thread. A close sibling is thread.Thread.join(), which waits for the thread to terminate. Blocks until timeout or completion. A close sibling is threading.Lock(), which creates a new primitive lock (mutex). Only one thread can acquire the lock at a time. More about this category: Thread-based parallelism — Thread, Lock, Semaphore, Event, Timer. Related Threading Module entries: threading.Thread(), thread.Thread.start(), thread.Thread.join(), threading.Lock(), threading.RLock(), threading.Semaphore().