Sharing variable among files?
If i declare a variable in boot.py is available to all files?
i was too fast, you have right global is for same unit
simple use qualified name e.g:
myvar = 7
import a def changea(): a.myvar+= 2 print(a.myvar) def printa(): print(a.myvar)
for test use
import b b.changea() >>>9 b.print(a) >>>9
@livius That does not work for me. Did you try that?
yes, you must do this with
def myproc(): global my_global_var my_global_var = 1
ok, this works fine but it appears that if i chnage the value of this variable within a function then it appears to not be reflected within other function or files? I assume this has something to do with variable scope?