How to call a async function from a synchronized code Python

@deceze answer is probably the best you can do in Python 3.6.
But in Python 3.7, you could directly use asyncio.run in the following way:

newfeature = asyncio.run(main(urls))

It will properly create, handle, and close an event_loop.

Leave a Comment