Skip to content
Sign upLog in

'await' outside function error

Profile icon
abriani434

I've encountered a very frustrating delay. I'm using the python environment and I'm having an error saying "SyntaxError: 'await' outside function". Does anyone know how to fix this?
Screen Shot 2021-06-30 at 11.57.27 PM


Screen Shot 2021-06-30 at 11.57.34 PM

You are viewing a single comment. View All
Profile icon
InvisibleOne

To use await, it needs to be inside of an asynchronous function, this will give you an error:

def hello(message): await message.channel.send("Hello!")

but this won't:

async def hello(message): await message.channel.send("Hello!")