Runtime and Context Modules

sched

General-purpose event scheduler with injectable clock and delay functions. Events are ordered by scheduled time and priority (smaller number runs first). run(blocking=False) runs due events without waiting for future events. It does not create worker threads.

Formal Syntax & Structure

python syntaxpython
import sched

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
import schedclock = lambda: 10scheduler = sched.scheduler(clock, lambda delay: None)scheduler.enterabs(10, 2, print, argument=("second",))scheduler.enterabs(10, 1, print, argument=("first",))scheduler.run(blocking=False)
Python Reference