I'm using a python API wrapper with async functions. I need to call the API several times and would like to override the async functionality by waiting for each task to complete before moving on to the next iteration.
import asyncio
loop = asyncio.get_event_loop()
for count in range(5):
loop.create_task(main(count)) # Need this line to complete before next iteration
time.sleep(60) # Hacky solution
Currently I'm just sleeping until I can assume main() is complete. How can I ensure main() never runs concurrently with itself?