Created
October 29, 2018 01:52
-
-
Save ali1234/c4d08c0e0a36e01c8ad27a8bf6060eaf 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 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
This is awesome, thank you so much!