I have a module named mdl with the below __init__.py (The contents don't actually matter).
from .document import load_document
Then I have a file called mdl.py:
import mdl
doc = mdl.load_document( "happy" )
mypy produces the error:
mdl.py:2: error: Module has no attribute "load_document"
If I rename the file to anything_else.py this error doesn't happen.
It appears as though mypy is resolving the mdl import to the file mdl.py instead of the mdl module directory. Since the Python interpreter resolve the names as I intended, I'd assume mypy would as well.
I have a module named
mdlwith the below__init__.py(The contents don't actually matter).Then I have a file called
mdl.py:mypyproduces the error:If I rename the file to
anything_else.pythis error doesn't happen.It appears as though mypy is resolving the
mdlimport to the filemdl.pyinstead of themdlmodule directory. Since the Python interpreter resolve the names as I intended, I'd assumemypywould as well.