Why the addon installation succeeds but the API is not accessible through the bpy module? I have compiled Blender 2.79b as a Python3 module on Ubuntu 16.04 LTS. I install an addon using bpy.ops.wm.addon_install(), enable it using bpy.ops.wm.addon_enable(module='packageName) and save the user preferences using bpy.ops.wm.save_userpref(). However, after I open Python3 again and do import bpy I cannot see the addon API's being added to the bpy module. If I run the same exact "addon installation" script when using Blender with the GUI everything works fine, but not when I have compiled Blender as a Python module. So I wonder, does anyone know whether I'm doing something wrong and how I can fix this?

In case you're wondering, I am trying to install Armory addon and below is the script I used to do the installation:

installArmory.sh

wget -O armsdk.zip https://www.dropbox.com/s/a17prr2hzsjkfog/armsdk.zip?dl=1
python3 installArmory.py


installArmory.py

import bpy, os, zipfile

with zipfile.ZipFile("armsdk.zip","r") as zip_ref:
    zip_ref.extractall(os.getcwd() + '/')

# Install the addon
bpy.ops.wm.addon_install(filepath=os.getcwd() + '/armsdk/armory/blender/addon/armory.py')
bpy.ops.wm.addon_enable(module='armory')

# Set the SDK path
user_prefs = bpy.context.user_preferences
addon_prefs = user_prefs.addons['armory'].preferences
addon_prefs.sdk_path = os.getcwd() + '/armsdk'

bpy.ops.wm.save_userpref()
I think I could find a way around this but I don't think this will work for all addons that require restarting Blender, but it works for Armory.

Here are the steps:

# Install the addon
bpy.ops.wm.addon_install(filepath=os.getcwd() + '/armsdk/armory/blender/addon/armory.py')
bpy.ops.wm.addon_enable(module='armory')

# Set the SDK path (Armory-specific)
user_prefs = bpy.context.user_preferences
addon_prefs = user_prefs.addons['armory'].preferences
addon_prefs.sdk_path = os.getcwd() + '/armsdk'

# Use the `start()` function of `bpy.ops.arm_addon` to enable it.
bpy.ops.arm_addon.start()


Now arm shows up in bpy.ops. I don't think all addons have a function like start() that Armory has.