I need to use global var across files/modules: # file_1.py a = 0 def funct_1() : a = 1 # a is global print(a)
# file_2.py from file_1 import * def main() : funct_1() a = 2 # a is local, it's not imported print(a) Here above 'a' is not imported from file_1, it's local. The only way I was able to access the global 'a' is the following: # file_2.py from file_1 import * import file_1 def main() : funct_1() file_1.a = 2 # a is the global from file_1 print(file_1.a) Question: How can I access to the global 'a' in file_2 without resorting to the whole name 'file_1.a' ? Thanks! -- http://mail.python.org/mailman/listinfo/python-list