I have something like this in the my add-on __init__ file:

class MyPreferences(AddonPreferences):
    bl_idname = __name__

    num: IntProperty(name="Number", default=888)

    def draw(self, context):
        layout = self.layout
        layout.prop(self, "num")

I need to get this number from another file, and "MyPreferences.num" doesn't work. It returns a tuple, where the first value is "<built-in function IntProperty>" and the second value is a dictionary.

I can access the dictionary values, but the only ones available are "name", "attr", and "default", so if the user changes the property, I can't access the new value.

What should I do?

  • $\begingroup$ Would help if this example was self contained $\endgroup$
    – ideasman42
    Oct 24, 2015 at 13:34

1 Answer 1


Something like this

addon = bpy.context.preferences.addons.get(addon_name)
if addon:
    prefs = addon.preferences

You must log in to answer this question.

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