.. _global-at-module-level:

global-at-module-level / W0604
==============================

**Message emitted:**

Using the global statement at the module level

**Description:**

*Used when you use the "global" statement at the module level since it has no effect*

**Problematic code:**

.. literalinclude:: /data/messages/g/global-at-module-level/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/g/global-at-module-level/good.py
   :language: python


**Related links:**

- `Official Python FAQ - global and local <https://docs.python.org/3/faq/programming.html#what-are-the-rules-for-local-and-global-variables-in-python>`_
- `PEP 3104 - Access to Names in Outer Scopes <https://peps.python.org/pep-3104/>`_
- `Python global statement <https://docs.python.org/3/reference/simple_stmts.html#global>`_

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