I was wondering if I declare a variable as global , can I share the same variable in a different file with the updated value. (ie) A global variable value to be used between different files without passing them within functions.
Say for eg.
Script 1
Script 2 (filename - script2)
------------
Is there a better way in which I use variables among different files without declaring them as global ?
Thanks
--V
Say for eg.
Script 1
Code:
global foo = "sample" def func1 global foo foo = "updated sample" print foo print foo func1 x = script2.script2() print foo
------------
Code:
class script2:
def __init__():
global foo
print foo
foo = "Updated in Script2 "
Thanks
--V
Comment