I have two files which roughly look like this. module1.py
:
GLOBAL_VAR = False
def some_func():
if 1 == 1:
GLOBAL_VAR = True
folder_1/module2.py:
from ..module1 import GLOBAL_VAR
if 2 == 2:
print(f"GLOBAL_VAR : {GLOBAL_VAR }")
Basically in one file I declare and assign a variable and in another file which is inside a subfolder it is used.
Issue is above throws a linting error in module1.py
that
F841 local variable 'GLOBAL_VAR' is assigned to but never used
How it is being used. So, how can I solve this linting error?