Using python you can install an addon with bpy.ops.wm.addon_install()
, you can then enable the addon with bpy.ops.wm.addon_enable()
and disable it with bpy.ops.wm.addon_disable()
. To keep the addon enabled every time you start blender you save your settings with bpy.ops.wm.save_userpref()
For addon_install
you give it the filepath to the addon, this is the same file you would choose if you were using blender's GUI.
To enable or disable an addon you need to specify the module name, that is the folder name installed into the addons folder or the filename without .py
for single file addons.
import bpy
bpy.ops.wm.addon_install(filepath='/home/shane/Downloads/testaddon.py')
bpy.ops.wm.addon_enable(module='testaddon')
bpy.ops.wm.save_userpref()
There are two ways you can make this work remotely through the CLI.
Save the steps in a script and run it.
blender -b -P enableaddon.py
Start blender as a python console and type each in directly.
blender -b --python-console
Python 3.5.2 <snip...>
(InteractiveConsole)
>>> import bpy
>>> bpy.ops.wm.addon_install(filepath='/home/shane/Downloads/testaddon.py')
>>> bpy.ops.wm.addon_enable(module='testaddon')
>>> bpy.ops.wm.save_userpref()
Note: For Blender 2.80+, things are slightly different:
>>> import bpy
>>> bpy.ops.preferences.addon_install(filepath='/home/shane/Downloads/testaddon.py')
>>> bpy.ops.preferences.addon_enable(module='testaddon')
>>> bpy.ops.wm.save_userpref()
Use ⎈ CtrlD to exit the python console and quit blender.
Blender\2.##\scripts\addons
, though you still need to activate it to be able to use it. $\endgroup$