I know this has been discussed many times.. however, I’ve read many, many answers here that did not show my specific use case, and all I would like is an answer that’s suitable for this very case. I love Python (most of it), but the import system is IMHO an absolute mess and very, very quirky and tricky to use.
I am developing a package, and I’d like to have a showcase.py
module inside of it which demonstrates the use of the package in the exact same manner and syntax that a user would use it from outside the package.
some_dir/package/__init__.py
showcase.py
If a user imports my package
from a module located in some_dir
, he can write import package
and use it. Now I’d would like to have this exact same import syntax in my showcase.py
module. I tried like many many things, but I cannot get it working. I am fine to amend sys.path if needed, I’d just like to know how to solve this one single problem.