Collection<PsiFileSystemItem> (@NotNull String name, boolean matchQualifiedName, @NotNull GlobalSearchScope scope) { List<PsiFileSystemItem> result = new ArrayList<>(); QualifiedName qualifiedName = QualifiedName.fromDottedString(name); List<PyFile> matchingModules = matchQualifiedName ? PyModuleNameIndex.findByQualifiedName(qualifiedName, myNode.getProject(), scope) : PyModuleNameIndex.findByShortName(name, myNode.getProject(), scope); for (PyFile module : matchingModules) { PsiFileSystemItem candidate = as(PyUtil.turnInitIntoDir(module), PsiFileSystemItem.class); if (candidate != null && PyUtil.isImportable(myNode.getContainingFile(), candidate)) { result.add(candidate); } } return result; }