There is no file() function in pymel. All of the mel 'file' commands
have been replaced with commands like saveFile() openFile()
importFile() etc.
Read the docs for pymel.core.language.Mel. I have to use it all the
time when a mel command is broken or not implemented in the core
namespace. I don't like to use it, as it handles errors differently
and returns strings instead of pynodes.
Even worse is mel.eval() which I use as a last resort to bypass python/
pymel completely because something is really broken...like in this
case.