I’m trying to run two coroutines together and using async, one is teleton telegram client and one async task who get data every minute for the telegram bot. Some code:
from asyncio import Runner
from asyncio import sleep
import asyncio
async def task_coro1():
print('First coro')
await sleep(1)
while True:
#do something
pass
async def task_coro2():
print('Second coro')
await sleep(1)
while True:
#do something
pass
asyncio.run(task_coro1())
asyncio.run(task_coro2())
already tried with asyncio.gather, with threading
New contributor
Zero Ainz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.