//moda.py
X = 88 # my X: global to this file only
def f():
global X # change my X
X = 99 # cannot see names in other modules
//////////////////////////////////////////////////////////////////
//Main.py
X = 11 # my X: global to this file only
import moda # gain access to names in moda
moda.f() # sets moda.X, not my X
print X, moda.X
|