Coroutine as background job in Jupyter notebook
问题 I have a coroutine which I'd like to run as a "background job" in a Jupyter notebook. I've seen ways to accomplish this using threading, but I'm wondering whether it's also possible to hook into the notebook's event loop. For example, say I have the following class: import asyncio class Counter: def __init__(self): self.counter = 0 async def run(self): while True: self.counter += 1 await asyncio.sleep(1.0) t = Counter() and I'd like to execute the run method (which loops indefinitely), while