diff --git a/jupyter_client/utils.py b/jupyter_client/utils.py index f2f3c4dc4..364d8f085 100644 --- a/jupyter_client/utils.py +++ b/jupyter_client/utils.py @@ -7,6 +7,10 @@ import inspect import os +import nest_asyncio # type: ignore + +nest_asyncio.apply() + def run_sync(coro): def wrapped(*args, **kwargs): @@ -15,7 +19,6 @@ def wrapped(*args, **kwargs): except RuntimeError: loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) - import nest_asyncio # type: ignore nest_asyncio.apply(loop) future = asyncio.ensure_future(coro(*args, **kwargs))