Steven D'Aprano added the comment: This is just module shadowing in action. If you have two or more modules, or packages, in the module search path, the first one found will block access to the others.
> this is a bad design in my opinion. *shrug* It is what it is. Often it is inconvenient. Occasionally it is useful. It is the same way nearly all other languages with a library search path works: the compiler searches for a library until it finds a match, then stops. How would you change this? Here are some unacceptable or impractical solutions: - get rid of the search path, and force the programmer to specify the full file system path of every module (package) they import; - use different syntax for importing a .py module and a package; - after an import, if there's an error, Python should automatically re-do the import with the next module in the module search path; - "I don't care how you fix it, that's your problem not mine". I think the answer here is: don't do this. Don't use a package with the same name as a module. ---------- nosy: +steven.daprano _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30503> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com