then I call the add method for script (script is of type PsiElement) to add a Psi element to it
now I have script with the added import statement, I want to update the actual file
this is one failing approach I took
FileDocumentManager.getInstance().getDocument(vFile) ); // vFile is from above, see 
the problem is that the file is not updated with the added import, see 
this utility function, see  may be the key. I had implemented it 2 ways.
the 1st one  does not return a virtual file calling getVirtualFile() (nullPtrException)
and the 2nd one  returns a "Light Virtual File." filepath in  is the path to the file in , the importFile
 return (PsiElement) PsiFileFactory.getInstance(IDEAUtils.getProject()).createFileFromText("BLAH.py", GroovyFileType.GROOVY_FILE_TYPE, script_file_path, System.currentTimeMillis(), false);
 //return (PsiElement) PsiFileFactory.getInstance(IDEAUtils.getProject()).createFileFromText(filepath, GroovyFileType.GROOVY_FILE_TYPE.getLanguage(), script_file_path);
Maybe approach  is wrong and/or approach  or  are incorrect as you need a virtual file to save a PsiElement.
My question again is,
if i change a PSI initially created against a file as in above -,
how do I save the changes to the file on in memory and disk too using the openapi framework?
Thanks for your time!