Forum Archive

__init__.py and __all__ in Pythonista

Phuket2

Firstly, I am not sure I understand this correctly, but what I think I understand this,
If I have a file named init in a directory with my other scripts, if I put in a assignment like all = ['one_of_my_important_include_files'] then when I import that file into another file, no data hiding is happening. Meaning vars defined in the file in the all list starting with a _ or a __ should be visible to the file that imports the module.
I know it's equivalent to from x import *.
Maybe the init.py is only when you create a package? It did not seen so though.
Anyway, I am getting an error in a .py file because it does not know a global name, but the module imports correctly or without an error. The var starts with a underscore!
Is there a problem with Pythonista handling init files, or have I just totally misunderstood something?
Any help appreciated

Phuket2

Sorry, deleted it. I was being stupid.