PsiElementVisitor (@NotNull ProblemsHolder holder, final boolean isOnTheFly, @NotNull final LocalInspectionToolSession session) { final PyUnresolvedReferencesVisitor visitor = createVisitor(holder, session); // buildVisitor() will be called on injected files in the same session - don't overwrite if we already have one final PyUnresolvedReferencesVisitor existingVisitor = session.getUserData(KEY); if (existingVisitor == null) { session.putUserData(KEY, visitor); } return visitor; }