Software Development

Python call async from sync

Python call async from sync

Translations: RU
There is a known issue in Python - you have to choose between sync and async code models. And if you are using async code you can call sync code but from that code you CAN’T call async code again. Why does this problem occur? The event loop used by the async code is already stuck waiting for the result from the sync code. And if you want to call async code now, you cannot reuse the same event loop.