Created
January 12, 2023 03:27
-
-
Save osiriswrecks/c2763f0cce3c1313f228bacd8d4714ac to your computer and use it in GitHub Desktop.
Accessing Blender's Python console from a terminal
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
''' | |
If you ever need to install, enable, or debug an add-on that's running on a headless Blender install | |
(ie, on a server like AWS Deadline), then you can run Blender's Python console from the terminal directly. | |
This was originally posted here: https://blender.stackexchange.com/questions/73759/install-addons-in-headless-blender, but | |
I'm saving in a Gist for future me and others. | |
First, run this in the terminal: | |
blender -b --python-console | |
Then, in Python as needed: | |
''' | |
import bpy | |
bpy.ops.preferences.addon_install(filepath='/home/user/testaddon.py') | |
bpy.ops.preferences.addon_enable(module='testaddon') | |
bpy.ops.wm.save_userpref() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment