Rolf Campbell <thats.unpossi...@gmail.com> added the comment:

OK, while I understand what you are saying, that is NOT how absolute imports 
work.  I'll give an example:

./main.py:import func
./main.py:print(f"Value of func.func after import func:{func.func}")
./main.py:import func.func
./main.py:print(f"Value of func.func after import func.func:{func.func}")
./func/__init__.py:func = 1
./func/__init__.py:from . import func
./func/__init__.py:print(f"Value of func after from . import func:{func}")
./func/func.py:print("Module imported")

Here, the relative import inside __init__.py does NOT load the "func.py" module 
because there is already an object called "func".

But, the absolute "import func.func" does load "func.py" even though there is 
already a "func.func" object.

Are these supposed to work differently?  That seems strange to me.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33547>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to