BLENDER_USER_SCRIPTS and multiple paths?

Updated the code for Blender 3.0 version. Now since the environment variables quirk has been found. The technique will rely on it.

blender\3.0\scripts\modules\addon_utils.py

line:50, only the # EXTRA SCRIPTS bit is needed

def paths():
    # RELEASE SCRIPTS: official scripts distributed in Blender releases
    addon_paths = _bpy.utils.script_paths(subdir="addons")

    # CONTRIB SCRIPTS: good for testing but not official scripts yet
    # if folder addons_contrib/ exists, scripts in there will be loaded too
    addon_paths += _bpy.utils.script_paths(subdir="addons_contrib")

    # EXTRA SCRIPTS
    import os
    if 'BLENDER_EXTRA_SCRIPTS' in os.environ:
        envpaths = os.environ['BLENDER_EXTRA_SCRIPTS'].split(os.pathsep)
        for p in envpaths:
            if os.path.isdir(p):
                addon_paths.append(os.path.normpath(p))

    return addon_paths
1 Like