API#
- async awaitlet.async_def(fn: Callable[[...], _T], *args: Any, assert_await_occurs: bool = False, **kwargs: Any) _T #
Runs a sync function
fn
in a new greenlet.The sync function can then use
awaitlet()
to wait for async functions.
- awaitlet.awaitlet(awaitable: Awaitable[_T]) _T #
Awaits an async function in a sync method.
The sync method must be inside a
async_def()
context.awaitlet()
calls cannot be nested.- Parameters:
awaitable¶ – The coroutine to call.