2
$\begingroup$

For my project, I am working on a GUI to load an object and get a rendered image from them with the parameters given within GUI. I am using Python and tkinter for development of my GUI. Currently, my solution is to edit the python script file and then load it in blender via subprocess command.

Is there any way to pass the parameters the user wants via run command of blender?

Thanks in advance.

$\endgroup$

1 Answer 1

1
$\begingroup$

It is possible to invoke Blender using Command Line Arguments including an argument to run a python script: -P <filename> or --python <filename>.

Within the script it is possible to access the entire command line, using something like

import sys
if len(sys.argv) > 1:
    for i in range(1,len(sys.argv)):
        print(f'\targ: {sys.argv[i]}')

which, for example will print all of the command line arguments. You could, of course, instead parse the arguments looking for the ones you want to process.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .