So Python global variables is a relative term
Examples:
test.py
a = 1
t1.py
SYS Import
Import test # Import test module
a = 1 # declare a variable
func1 DEF ():
Global # A reference to the global variable current namespace
a + = 1
func2 DEF ():
test.a. 1 = # + reference variable test module namespace
func3 DEF ():
# Print (the sys.modules) # records all modules of the current file into the
module = sys.modules [ 'test'] # secondary reference test imported modules
module.a + = 1 # referenced test module naming space variables
func1()
func2()
func3()
print (a) # Results: 2
Print (test.a) # Results: