Inspectopedia 2026.2 Help

Global variable redeclaration in notebook

This inspection detects cases where a global variable is re-declared within the same Jupyter notebook. Redefining global variables can lead to unexpected results or bugs, especially when executing cells in an arbitrary order.

Redefinitions of common loop variables (e.g., i, j, k, etc.) are ignored to reduce noise. However, redefinition of larger objects like lists, DataFrames, or dictionaries is flagged as a potential issue.

If the redefinition is intentional, you can use the provided "Suppress for this statement" quick-fix to silence the warning for that specific occurrence.

Note: This inspection applies only to Jupyter notebook files (.ipynb).

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

PyGlobalVariableRedeclarationInNotebook
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Python

Inspection ID: PyGlobalVariableRedeclarationInNotebookInspection

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection PyGlobalVariableRedeclarationInNotebook

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

CLion 2026.2, IntelliJ IDEA 2026.2, PyCharm 2026.2, Qodana for JVM 2026.2,

Last modified: 30 June 2026