This is probably a bug in mypy. It can be reproduced by creating a directory ``a`` with only two files in there: an ``__init__.py`` and ``b.py`` ``` $ cat a/__init__.py from .b import X ``` and ``` $ cat a/b.py # type: ignore[no-redef] class X: pass __all__ = ['X'] ``` Mypy gives the following output: ``` $ mypy a/ a/__init__.py:1: error: Module 'a.b' has no attribute 'X' Found 1 error in 1 file (checked 2 source files) ``` Remove the ``type: ignore[no-redef]`` and mypy succeeds. I would not expect that ignoring something (even leaving ``type: ignore`` in there makes mypy fail), would break the imports. This is an issue for prompt_toolkit: https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1008