I want to add my own tasks to the asyncio loop, so I’m trying to use ApplicationRunner idiomatically with asyncio.run(main())
, and the main coro has
async def main() {
# all examples in the wild loop like this :frowning:
tasks = [asyncio.create_task(my_coro1),
asyncio.create_task(my_coro2),
coro # from ApplicationRunner.run with start_loop=False
]
await asyncio.gather(*tasks)
But ApplicationRunner seems to create its own loop so running the coro results in “attached to a different loop” error.
In general what is the idiomatic way to add your own tasks to the event loop?