I thought I understood and fixed this problem: A variable defined in a module remains undefined after I import the module. Here is the simplified version.The main script and the module are in the same folder/dir.This is my module: mysettings.py
def main():
myvar = "This is imported."
if __name__ == '__main__':
main()
This is my script: irp.py:
import mysettings
def main():
print myvar
if __name__ == '__main__':
main()
Interpreter error:NameError: global name 'myvar' is not definedCan you tell me why?Thanks,