global variables python multiple files code example
Example: python global variable across files
# config.py
x = 0
# mod.py
import config
config.x = 1
# main.py
import config
import mod
print(config.x) # will print '1'
# config.py
x = 0
# mod.py
import config
config.x = 1
# main.py
import config
import mod
print(config.x) # will print '1'