Run a plain callback after a delay.
Section: Event Loop Management
Schedule a callback later
python
python
import asyncio
def on_timer():
print("timer fired")
async def main():
loop = asyncio.get_running_loop()
loop.call_later(0.2, on_timer)
await asyncio.sleep(0.3)
asyncio.run(main())Explanation
For plain callbacks rather than coroutines, use loop scheduling methods.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Event Loop Management
Schedule from another thread
Use `call_soon_threadsafe()` when another thread must notify the loop.
Submit a coroutine from another thread
Use `run_coroutine_threadsafe()` with a loop reference.
Prefer `get_running_loop()` in async code
Modern replacement for older loop access patterns.
Know the file I/O caveat
Document the limitation around file descriptor watching for ordinary file I/O.