asyncio.run()

Probably you were looking for help about this function

asyncio.run(coro, *, debug=None)
Description
The asyncio.run() is a Python function used to run a coroutine in an event loop. This function creates an event loop, runs the coroutine in the event loop, and finally closes the event loop when the coroutine is complete.
Note: asyncio.run() should only be used once in a program and is intended as a convenient function to run asynchronous functions in a simple, single-threaded manner. For more advanced usage and control over the event loop, use asyncio.run_until_complete() and asyncio.get_event_loop() instead.
Parameters
  • coro (coroutine) – The coroutine to run.
  • debug (bool) – If set to True, it will enable the debug mode for the asyncio event loop.
Return type
This function does not return any value.
Raises
  • ValueError – If the event loop is already running in the same thread.
Example

import asyncio

async def main():
    print("Hello, World!")

asyncio.run(main())

Made on
Tilda