(I've checked out Does Python have “private” variables in classes? -- it asks about classes rather than modules. As such, answers there don't cover import
which is what I'm interested in.)
Consider, there is a module called X
with variable y
. If any other module tries to import
the module X
, how to avoid loading the variable y
in Python?
For example:
# x.py
y=10
We then use this in some other module:
import x
print x.y
How to avoid accessing x.y from the module x.py ?