.. _await-outside-async:

await-outside-async / E1142
===========================

**Message emitted:**

``'await' should be used within an async function``

**Description:**

*Emitted when await is used outside an async function.*

**Problematic code:**

.. literalinclude:: /data/messages/a/await-outside-async/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/a/await-outside-async/good.py
   :language: python



**Related links:**

- `PEP 492 <https://peps.python.org/pep-0492/#await-expression>`_


Created by the `typecheck <https://github.com/PyCQA/pylint/blob/main/pylint/checkers/typecheck.py>`__ checker.