View Full Version : file command - open in new instance of maya
01-18-2013, 05:43 PM
Is that even possible in MEL / python?
I'd like to open a file in a new instance of maya with a "file -open" command.
If that's not possible in mel/python, is there another way?
01-23-2013, 12:56 AM
Cant be done with the file command. You can do it with the system command using Mel. The code below outta do it. Just replace the $file with the file you wish to open.
string $file = "C:/test/test.ma";
string $maya = `getenv maya_location`+"/bin/maya.exe";
system ("start "+ $maya + " " + $file);
I forgot about the python code. It's not as friendly as the Mel, i'm sure people will comment on a cleaner way to do it.
import maya.cmds as cmds
import maya.mel as mel
mayaDir = mel.eval('getenv maya_location')
maya = str(mayaDir+'/bin/maya.exe')
mayaDirShortName = maya.replace("Program Files", "Progra~1")
mayaFile = "C:/test/test.ma"
os.system("start "+ mayaDirShortName + " " + mayaFile)
01-23-2013, 11:34 AM
Works like a charm! :)
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.