[issue33547] Relative imports do not replace local variables
Rolf Campbell
report at bugs.python.org
Fri May 18 18:11:53 EDT 2018
Rolf Campbell <thats.unpossible at gmail.com> added the comment:
OK, OK, I think I finally understand what you mean here. Let me try to repeat it just to make sure I really understand:
When requesting a member of a multi-file module (like "func" in my example), python only tries to load that member as a module from disk if there isn't something already created as part of __init__.py.
In my case, I'm trying to load "func.func" which I specifically created in line#1 of func/__init__.py, so Python sees no need to even try to load the func/func.py file.
If I comment-out the first line of func/__init__.py, then Python fails to find an item called "func.func" and so it tries to load one from disk which causes it to load "func/func.py".
My real problem here was that I shouldn't be creating entries in the "func" namespace that clash with on-disk sub-modules that I want loaded.
Thanks for your time and effort in explaining this.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33547>
_______________________________________
More information about the Python-bugs-list
mailing list