Global var editing from another script in Python -
i'm trying increment python global var script, doesn't seem updating. doing wrong here?
i run func() multiple times during script execution , never seems update globval
script 1:
def func(): script2 import globval global globval print "glob val " + str(globval) globval = globval + 1 script 2 (different file):
global globval globval = 1
yes, are doing wrong (answering first question)
you should move from script2 import globval top of script2 value being imported each time 1. after moving import top, globval variable should update.
Comments
Post a Comment