I'm trying to increment a python global var from another script, but it doesn't seem to be updating. Am I doing something wrong here?
I run func() multiple times during the script execution and it never seems to update globVal
script 1:
def func():
from script2 import globVal
global globVal
print "glob val is " + str(globVal)
globVal = globVal + 1
script 2 (different file):
global globVal
globVal = 1
globValand declare it as global, it will take precedence over an existingglobVal, if there is such variable. You may want to forgo thefuncfunction entirely, as well as the global declarations.