diff --git a/mypy/modulefinder.py b/mypy/modulefinder.py index fee484ae02fb..5adb7c059e07 100644 --- a/mypy/modulefinder.py +++ b/mypy/modulefinder.py @@ -553,7 +553,11 @@ def _find_module(self, id: str, use_typeshed: bool) -> ModuleSearchResult: return ancestor if approved_stub_package_exists(id): - return ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED + if len(components) == 1 or ( + self.find_module(components[0]) + is ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED + ): + return ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED elif found_possible_third_party_missing_type_hints: return ModuleNotFoundReason.FOUND_WITHOUT_TYPE_HINTS else: