Skip to content

Commit

Permalink
launch cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Pullusb committed Jul 10, 2023
1 parent fd93875 commit 8802fd4
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions snippets/dev/execute_script_in_blender_with_args.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Run Blender and execute a script, with passed arguments

import subprocess

## Argument
# -d (--destination) Destination folder for the blend

bin = '/opt/blender-3.6.0/blender'
blend = '/my_file.blend'
script = '/my_script.py'
script_option = 'my_script_option'

cmd = [
bin,
'--factory-startup', # '--enable-autoexec',
'-b', blend,
'-P', script,
'--',
'-d', script_option,
]

# source_folder = ''

## add options
# opt = ['-s', source_folder] if source_folder else []
# cmd += opt


print(' '.join(cmd))
subprocess.call(cmd)

0 comments on commit 8802fd4

Please sign in to comment.