PyFile (@NotNull PyFile initPy) { if (PythonSdkUtil.isElementInSkeletons(initPy)) { QualifiedName packageName = findShortestImportableQName(initPy); if (packageName != null) { List<PsiElement> namesakeResults = PyResolveImportUtil.resolveQualifiedName(packageName, PyResolveImportUtil.fromFoothold(initPy)); PsiElement nonSkeletonResult = ContainerUtil.find(namesakeResults, e -> !PythonSdkUtil.isElementInSkeletons(e)); PsiDirectory libPackage = as(nonSkeletonResult, PsiDirectory.class); if (libPackage != null) { PyFile libInitPy = as(PyUtil.turnDirIntoInit(libPackage), PyFile.class); if (libInitPy != null && libInitPy != initPy) { return libInitPy; } } } } return initPy; }