run_coroutine#

omni.kit.async_engine.run_coroutine(coroutine: Coroutine)#

Submit a coroutine object to the main event loop; return either a Task object if the function was called from the main thread, or a concurrent.futures.Future to access the result if the function was called from any other non-main thread.

Parameters:

coroutine (coroutine) – The coroutine to schedule for execution.

Returns:

An asyncio.Task if called from the main thread, otherwise a concurrent.futures.Future.

Return type:

Union[asyncio.Task`, :obj:`concurrent.futures.Future]

Raises:

TypeError – If the provided coroutine is not an actual coroutine object.