I have the following code :
async def async_function():
await some_function()
# TODO : Doesn't work
def sync_function():
for i in range (100):
async_function()
In the past I had no loop in sync_function, so I managed to call async_function using asyncio.run(). Now that I have a this for loop, I don't find the proper way to handle my asynchronous function.
The current code throws the following warning
RuntimeWarning: coroutine 'async_function' was never awaited
And part of the logic in it is not done during runtime.
What would be the good way to do this ?
awaittheasync_function(recommended) or you can callasyncio.runas before but in the loop (should work but isn't efficient).