jupyter_client
jupyter_client copied to clipboard
Comms with async functions
Hi,
Is there a recommendation for when a comm needs to call an async function. While support for https://github.com/jupyter/jupyter_client/issues/433 would be ideal, the usecase is that there is some async def foo()
that needs to be called from within a comm. For now, the best way to work around this was to make it synchronous via (using ideas from https://github.com/ipython/ipython/issues/13670#issuecomment-1140245675):
import nest_asyncio
nest_asyncio.apply()
asyncio.run(foo())
This seems to work, but I didn't know if there was a better way.