Apologies in advange for the newbie question. I can't get my head around this, and the docs don't help!
Consider the following directory structure:
spam.py
foo / __init__.py
ham.py
eggs.py
with the following code:
# __init__.py
# blank
# ham.py
print( "got ham!" )
# eggs.py
print( "got eggs, importing ham!" )
import foo.ham
Now, if I import foo.eggs inside spam.py (!), the right thing happens and all the module references work.
BUT
If I try and execute eggs.py directly, I get an ImportError: No module named foo.ham! If I change the foo.ham imports to just ham, the right thing happens... but then I can't import foo.eggs!
So, how do I develop eggs? If I use 'undotted' references, I can develop fine, but can't try it out because I can't import the module! If I use the full foo.ham reference, I can import the package, but can't execute the submodule for development purposes!
Is this just a glitch with Python's packaging architecture? Am I doing it wrong?