Closed
Description
Structure:
sample_proj/__init__.py
:
from sample_proj.commons import some_const
from sample_proj.some_file import SomeClass
sample_proj/comons.py
:
some_const = 'qwe'
sample_proj/some_file.py
:
# type: ignore
from sample_proj.commons import some_const
class SomeClass:
def fun(self, param=some_const):
pass
$ mypy sample_proj
sample_proj/__init__.py:2: error: Module "sample_proj.some_file" has no attribute "SomeClass"
Found 1 error in 1 file (checked 3 source files)
I think it's a bug.
Removing # type: ignore[union-attr]
helps. I wanted this comment to ignore only this exact error in the whole file.
$ mypy --version
mypy 0.942
$ python3 --version
Python 3.10.5