suppose there is a variable "age" in 1.py and it is declared global inside 1.py. will the same variable "age" also be automatically declared as global in 2.py, and any other subsequent python files in the same directory?
Asked
Active
Viewed 65 times
2
-
Global declarations are in individual functions, not files. – Barmar Oct 18 '20 at 07:58
-
1But in general, nothing in one file affects any other file, unless you import one of them into the other. – Barmar Oct 18 '20 at 07:58
-
1A good explanation here: https://stackoverflow.com/a/3400652/10498119 – Subir Verma Oct 18 '20 at 08:00
-
tysm @SubirVerma – cheemse Oct 18 '20 at 08:07