In [1]:
import asyncio

async def do_something():
    await asyncio.sleep(1)
In [2]:
loop = asyncio.get_event_loop()
loop
Out[2]:
<_UnixSelectorEventLoop running=True closed=False debug=False>
In [3]:
loop.run_until_complete(do_something())
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-3-1d8c1195626b> in <module>
----> 1 loop.run_until_complete(do_something())

~/.pyenv/versions/3.9.0/lib/python3.9/asyncio/base_events.py in run_until_complete(self, future)
    616         """
    617         self._check_closed()
--> 618         self._check_running()
    619 
    620         new_task = not futures.isfuture(future)

~/.pyenv/versions/3.9.0/lib/python3.9/asyncio/base_events.py in _check_running(self)
    576     def _check_running(self):
    577         if self.is_running():
--> 578             raise RuntimeError('This event loop is already running')
    579         if events._get_running_loop() is not None:
    580             raise RuntimeError(

RuntimeError: This event loop is already running
In [4]:
loop.create_task(do_something())
Out[4]:
<Task pending name='Task-1' coro=<do_something() running at <ipython-input-1-84dce7f2e3fe>:3>>