I am running script 2 from script 1 but the output of script 2 is not stored as a variable in script 1.
script1
def main():
selection = int(raw_input("Enter Selection: "))
if selection == 1:
a = 1
import script2
result = script2.doit(a)
print result
return True
elif selection == 0:
return False
while main():
pass
print result
script 2
def doit(a):
return a+2
Although result gets printed after an iteration, it is not stored as "result" after I end the loop. print result outside the loop gives the error "NameError: name 'result' is not defined".