If I was you, I’d turn that around.

   1. Run script
   2. Script opens file

For example.

*fixIt.py*

# Gain access to maya.cmdsfrom maya import standalone
standalone.initialize()
# Use maya.cmds to do magicfrom maya import cmds
cmds.file("d:/test.ma", open=True)
print("Fixing it")

That you could run as such:

"c:\program files\autodesk\maya2023\bin\mayapy.exe" "d:/fixIt.py"


On Mon, 26 Sept 2022 at 19:37, tomas mikulak <mikulakto...@gmail.com> wrote:

> Hi,
> I have a question about running python script on maya file opened with
> batch mode.
> So far I was calling mel that ran python, but now I see more simpler
> solution with python.
> let's say a want to open a file d:\test.ma and run a python script on it
> called fixIt.py that has def whatTo(name, fixName)
>
> So I need to pass some arguments to this definition under script.
>
> so the syntax should be:
> "c:\Program Files\Autodesk\Maya2018\bin\mayabatch" -batch -file "D:test.ma"
> -command " "
>
> thanks,
> tomas
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CAEUzAD19O%3DZ8-7LnmSfp1-b0FzvBLfAREjzcLkXaktsvUOd-_A%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAEUzAD19O%3DZ8-7LnmSfp1-b0FzvBLfAREjzcLkXaktsvUOd-_A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOxpnvS3yUxbThrzmsuQa4xfX1VYVVgxqQGrRoR0E3Pg%40mail.gmail.com.

Reply via email to