Support for running async functions in sync functions

Feature or enhancement
Support for running async functions in sync functions
Pitch
Currently only running async functions inside sync functions is only available with
asyncio.run(func(x)) or loop.run_until_complete(); however when there is a running loop, these calls cannot be used.
The only way is running the function in background, and using callback functions(which is very limiting)

event_loop = asyncio.get_event_loop()
task = event_loop.create_task(func(*args))
task.add_done_callback(callback_func)

See example PR

A bit Related:

1 Like