When a module mod1.py and mod2.py exists in the same directory, I can import mod2 in mod1 directly as
import mod2
or relative with
from . import mod2
Is there any preferable way to do this?
I am asking because if mod1 is imported in mod2 as well, the relative import will not work.
Implicit relative imports are gone in Python 3. So clearly, they are deprecated, primarily because they collide with absolute imports (i.e. if there was a global module mod2, how would you import that?).
You are right that circular explicit relative imports don’t work; this is a bug. As a consequence, the preferable way is to avoid circular imports.