sched.scheduler()
sched.scheduler() is a Python function in the Sched Module category. Creates an event scheduler for delayed/periodic tasks. The syntax is sched.scheduler(timefunc=time.monotonic, delayfunc=time.sleep). Returns: Scheduler object. A typical example: import sched, time
s = sched.scheduler()
def greet():
print("Hello!")
s.enter(5, 1, greet) # Schedule in 5 seconds
s.run() # Run scheduled events. A close sibling is scheduler.enter(), which schedules an event after `delay` seconds. A close sibling is scheduler.enterabs(), which schedules an event at an absolute time. A close sibling is scheduler.cancel(), which cancels a scheduled event. A close sibling is scheduler.run(), which runs all scheduled events. Blocks until no more events. More about this category: Event scheduler — scheduler, enter, enterabs, run, cancel. Related Sched Module entries: scheduler.enter(), scheduler.enterabs(), scheduler.cancel(), scheduler.run(), scheduler.empty(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.