Hi all,

Currently, you can not use await outside an async function, the following code:

  async def lol():
    return 'bar'

  def test():
    return await lol()

  print(test())

Will fail with: SyntaxError: 'await' outside async function

Of course, you can use asyncio.run and then it works fine:

  import asyncio

  async def lol():
    return 'bar'

  def test():
    return asyncio.run(lol())

  print(test())

Why not make using await do asyncio.run "behind the scenes" when called outside async function ?

Thank you in advance for your replies

--