Jun-04-2018, 02:49 AM
Hi,
I had two python scripts r1.py and r2.py
In r1.py I used a variable named "test" in a function and I want to use this in r2.py.
I tried but not able to get it.
Please help
r1.py
I had two python scripts r1.py and r2.py
In r1.py I used a variable named "test" in a function and I want to use this in r2.py.
I tried but not able to get it.
Please help
r1.py
test = 10 def f1(): global test test = test + 100r2.py
import r1 a = test + 100 print aoutput: When I ran python r2.py
Output:Traceback (most recent call last):
File "r2.py", line 2, in <module>
a = test + 100
NameError: name 'test' is not defined