Assume the following code:
import asyncio
import time
async def say_after():
for i in range(10):
await asyncio.sleep(1)
print("first function")
async def say_after2():
for i in range(10):
await asyncio.sleep(1)
print("second function")
async def main():
await say_after()
await say_after2()
asyncio.run(main())
It would first print "first function"
10 times and after function say_after
is finished then it would print "second function"
10 times. now i want to run both functions at the same time like 2 threads (like parallel) with asycio
not sequential executing. how do i do it?