I have a module in which there is a function that takes an input, processes it, then returns an output. When I call this module's function it appears to work, but I am unable to access the 'result' variable from the main program.
file_a.py:
result = False
def test(incoming):
if incoming > 3:
result = True
else:
result = False
print(result)
return result
file_b.py:
import file_a
for i in range(5):
file_a.test(i)
print(i, file_a.result)
interrogating result from within test() produces the desired result (i.e. it changes to True when expected), but from the main loop file_a.result is always False.