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.

Correct code:

TOMATO = "black cherry"


def update_tomato():
    global TOMATO
    TOMATO = "moneymaker"

Problematic code:

def update_tomato():
    global TOMATO  # [global-variable-undefined]
    TOMATO = "moneymaker"

Created by the variables checker.