i made an addon that uses custom properties to drive other properties within that file. but the thing is, it only works in that file. when i append the collection containing everything into another blend file, the custom properties dont drive the values even though the drivers are still there. i want to be able to use the custom properties in the addon to drive these other properties when i put it in a new file. below are the steps to replicate my issue

install this small test script as an addon

bl_info = \
        "name" : "Test",
        "author" : "Desper",
        "version" : (1, 0, 0),
        "blender" : (3, 3, 1),
        "location" : "View 3D > N-Panel",
        "description" :
        "category" : "Workflow",

import bpy
from bpy.types import Panel

class Testing(bpy.types.Panel):
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'
    bl_label = "Test"
    bl_idname = "gp"
    bl_category = 'Test'
    def draw(self, context):
        layout = self.layout
        col = layout.column()
        row = col.row()
        row.prop(context.scene, 'subdiv', toggle=False, text='Viewport Subdivision')


def register(): 
    for c in classes:
    bpy.types.Scene.subdiv = bpy.props.BoolProperty(
def unregister():
    for c in classes:

if __name__ == '__main__':

once thats installed, make sure you see this

enter image description here

-add a subdivision modifier to a primitive (or anything)

-copy the custom property as a new driver (right click > copy as new driver)

-paste the driver on the subdivision visibility in the viewport

-the custom prop should now control viewport subdivision of the cube

-put the cube in a new collection

-save the file and append the collection into another new file

-in the new file, the addon should still be there but the checkbox wont work even though the driver is still there

That's a smaller-scale version of what my issue is.

let me know if any other info or any files are needed!

EDIT: this is the error i get when trying to enable the addon when ``` bpy.context.Scene.subdiv = True

enter image description here

EDIT 2 : here is the blend file

  • $\begingroup$ try adding this in register: bpy.context.scene.subdiv = True because you didn't really create the variable, you just declared it $\endgroup$
    – Chris
    Commented Dec 7, 2022 at 16:50
  • $\begingroup$ My guess is because the driver references the scene of the source file, not the active scene. you can try to mess with the driver expression see blender.stackexchange.com/questions/28269/… $\endgroup$
    – Gorgious
    Commented Dec 7, 2022 at 16:59
  • $\begingroup$ @Chris tried that with both a capital s for scene and lowercase. got this error when trying to enable the addon both times $\endgroup$
    – desperrrr
    Commented Dec 7, 2022 at 17:04
  • $\begingroup$ i did this: [1]: i.sstatic.net/2cpeo.png and at least i got no error like you...can you show us your modified code? (lowercase pls) $\endgroup$
    – Chris
    Commented Dec 7, 2022 at 17:07
  • 1
    $\begingroup$ @Chris I think it's because you're running the script in the text editor inside Blender, the scene is available at this point. But when running it as an addon it executes when the file loads, and the context is not initialized yet. $\endgroup$
    – Gorgious
    Commented Dec 7, 2022 at 17:20

1 Answer 1


When appending part of a blend file to another, it makes a new scene making bpy.context.scene useless in one scene but working in the other. you just need to figure out which scene it doesn't work in and delete it or just not use it.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .