boolean (@NotNull PsiElement usage) { // Don't use PyUtil#multiResolveTopPriority here since it filters out low priority ImportedResolveResults final List<PsiElement> resolvedElements = new ArrayList<>(); if (usage instanceof PyReferenceOwner) { final var context = TypeEvalContext.codeInsightFallback(usage.getProject()); final PsiPolyVariantReference reference = ((PyReferenceOwner)usage).getReference(PyResolveContext.implicitContext(context)); for (ResolveResult result : reference.multiResolve(false)) { resolvedElements.add(result.getElement()); } } else { final PsiReference ref = usage.getReference(); if (ref != null) { resolvedElements.add(ref.resolve()); } } final PsiFile containingFile = usage.getContainingFile(); if (containingFile != null) { for (PsiElement resolved : resolvedElements) { if (resolved instanceof PyStarImportElement && resolved.getContainingFile() == containingFile) { return true; } } } return false; }