Sdk (@NotNull PsiElement element) { Project project = element.getProject(); Module module = ModuleUtilCore.findModuleForPsiElement(element); if (module != null) { Sdk sdk = PythonSdkUtil.findPythonSdk(module); if (sdk != null) { return sdk; } } return ProjectRootManager.getInstance(project).getProjectSdk(); }