PyFunction (PyFunction function) { TypeEvalContext context = TypeEvalContext.userInitiated(function.getProject(), null); List<PsiElement> superMethods = new ArrayList<>(search(function, true, context).findAll()); while (superMethods.size() > 0) { function = getBaseMethod(superMethods, function.getContainingClass()); superMethods = new ArrayList<>(search(function, true, context).findAll()); } return function; }