PyDocs

Nav

Networking and Interprocess Communication

to_thread

asyncio

async function · Added in 3.9 (source) not WASI
  • to_thread(func, /, *args, **kwargs)
Asynchronously run function *func* in a separate thread.

Any *args and **kwargs supplied for this function are directly passed
to *func*. Also, the current :class:`contextvars.Context` is propagated,
allowing context variables from the main thread to be accessed in the
separate thread.

Return a coroutine that can be awaited to get the eventual result of
*func*.
0 Examples
No examples for asyncio/to_thread.
See Also
No see-alsos for asyncio/to_thread
0 Notes
No notes for to_thread