K
Kurda Yon
Hi,
I would like to declare a global variable, which is seen to a
particular function. If I do as the following it works:
x = 1
def test():
global x
print x
return 1
However, it does not helps since my function is in a separate file. In
other words I have a main program which has the following structure:
from test import test
x = 1
y = test()
and I have a test.py file which contains the "test" function:
def test():
global x
print x
return 1
In this case the test does not see the global variable x. How can I
make the x to be visible?
Thank you.
I would like to declare a global variable, which is seen to a
particular function. If I do as the following it works:
x = 1
def test():
global x
print x
return 1
However, it does not helps since my function is in a separate file. In
other words I have a main program which has the following structure:
from test import test
x = 1
y = test()
and I have a test.py file which contains the "test" function:
def test():
global x
print x
return 1
In this case the test does not see the global variable x. How can I
make the x to be visible?
Thank you.