.. _global-variable-undefined:

global-variable-undefined / W0601
=================================

**Message emitted:**

Global variable %r undefined at the module level

**Description:**

*Used when a variable is defined through the "global" statement but the variable is not defined in the module scope.*

**Problematic code:**

.. literalinclude:: /data/messages/g/global-variable-undefined/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/g/global-variable-undefined/good.py
   :language: python



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