I was playing the the Python\'s import system in order to understand better how it works, and I encountered another problem. I have the following structure
Python 3 changed the import system so every time you want a module that is around the one you are working, you need relative imports (unless you mess with PYTHONPATH
or sys.path
).
The correct usage here should be
from .subpkg import a
When you are working with IDLE, you have a totally different environment. Therefore, you could add the current location to your path so imports work again.
try:
sys.path.insert(0, '')
It might be weird, but it is for a greater good
PS: If this last thing do not work -- I don't have an IDLE environment right now -- it is probably because the work directory is set wrong.
Try this answer instead: https://stackoverflow.com/a/17361545/754991