void () { final Collection<T> elementsCollection = MembersManager.fetchElements(myMemberInfoCollection); final Collection<? extends PyElement> references = myManager.getElementsToStoreReferences(elementsCollection); // Store references to add required imports for (final PyElement element : references) { PyClassRefactoringUtil.rememberNamedReferences(element, PyNames.CANONICAL_SELF); //"self" is not reference we need to move } // Move final Collection<PyElement> newElements = myManager.moveMembers(myFrom, myMemberInfoCollection, myTo); // Restore references to add appropriate imports for (final PyElement element : newElements) { PyClassRefactoringUtil.restoreNamedReferences(element, null, references.toArray(PsiElement.EMPTY_ARRAY)); } }