cmdAndArgs = 'mayapy.exe -m mayaPy.avol.batchExportInit '+objExportedScene+' '+avolObj.NodeName+' '+camExportedScene+' '+str(createPreviewRender)
tempFolder = os.path.dirname(objExportedScene)
# Create log file
sdtoutFile = r'%s\stdout.txt' %tempFolder
stderrFile = r'%s\sterr.txt' %tempFolder
outptr = file(sdtoutFile, 'w')
errptr = file(stderrFile, 'w')
# Call the subprocess using convenience method
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags = subprocess.STARTF_USESHOWWINDOW
retval = subprocess.call(cmdAndArgs, startupinfo=startupinfo, bufsize=0, executable=None, stdin=None, stdout=outptr, stderr=errptr)
# Close log handles
errptr.close()
outptr.close()
This works fine for me... From maya I am exporting an object, I start a maya in background using mayapy.exe, I cleanup the object, save it, etc. In my case maya is loked because I am waiting for the stdout of the subprocess, but if you send the process and don't wait for it, maya should be free.