I have a folder with a __init__.py
File __init__.py:
#!/usr/bin/python2
flags="test"
File main.py:
#!/usr/bin/python2
import foldername
def main():
print foldername.flags
if __name__ == '__main__':
main()
Now, when I run ./main.py (from inside the folder), I get the error
ImportError: No module named foldername
foldernameis in your python path (environment variablePYTHONPATH).flags- It should befoldername.flags.main. Andmain.pyshould not be inside the same folder.main.pymay be inside the same folder. Python 2.7 even supports it explicitly with__main__.pyname.