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?

• Would help if this example was self contained Oct 24 '15 at 13:34

addon = bpy.context.preferences.addons.get(addon_name)