PyExpression (Project project, String name, PsiElement declaration) { final String text = declaration.getText(); final String self_name = text.substring(0, text.indexOf('.')); return PyElementGenerator.getInstance(project).createExpressionFromText(LanguageLevel.forElement(declaration), self_name + "." + name); }