#!/usr/bin/env python3 # -*- coding: utf-8 -*- import time async def foo(): await time.sleep(1) foo()
I couldn\'t make this dead simple example
If you already have a loop running (with some other tasks), you can add new tasks with:
asyncio.ensure_future(foo())
otherwise you might get
The event loop is already running
error.