-
-
Save torrinworx/70165def9bd792f01b355b328cac1c2d to your computer and use it in GitHub Desktop.
A Python script which runs itself inside Blender upon being run from the command line. Passes through command line arguments.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import sys | |
| try: | |
| import bpy | |
| except ImportError: | |
| print('Running myself inside Blender') | |
| import subprocess | |
| exit(subprocess.call(['blender', '--background', '--python', __file__, '--'] + sys.argv)) | |
| print('I am running in blender') | |
| argv = sys.argv | |
| argv = argv[argv.index("--") + 1:] # get all args after "--" | |
| print(argv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment