How do I get a value from an addons preferences

I’m trying to get a single value from the preferences like described in the manual here:
I would expect when I print: print(addon_prefs.filepath) I get the value but it returns so _PropertyDefered object. I tried but that seems not to exist according to the error I’m getting.
So the question is: How can I retrieve one single value from the prefs? I’d need it to return ‘Example File Path’ not:
<_PropertyDeferred, , {‘name’: ‘Example File Path’, ‘subtype’: ‘FILE_PATH’}>

1st thing to note is that preferences are part of the add-on’s registration process so they are only available if the add-on has been successfully registered and enabled.

If the add-on is enabled; preferences for a named addon can be found at:
prefs = bpy.context.preferences.addons["your add-on name"].preferences
and individual preference values can be accessed at:

1 Like

That is exactly what I’m doing but it returns <_PropertyDeferred, , {‘name’: ‘Example File Path’, ‘subtype’: ‘FILE_PATH’}> instead of just the name value, in this case “Example File Path” and I can’t seem to find a way to extract this value from a _PropertyDeferred object.

Which version of blender are you using?

Keep in mind within the bl_info section you may need to update the "blender": (3, 4, 1), for the add-on to properly load if you just copied it from the example in the docs you linked earlier.

Once it is properly loaded you should see the panel appear in the addon.

If the panel is not visible the addon has not actually loaded properly.

I figured it out. The problem was the way I defined the properties. However I copied this from the reference it doesn’t work in Blender 2.9 and up. The reference uses
filepath = StringProperty(
name=“Example File Path”,
default= “TEST”,

Instead of:
filepath : StringProperty(
name=“Example File Path”,
default= “TEST”,

Hmmm… the : notation does work in Blender 2.9 and up, it works all the way up to 3.4 that I’ve tested. I say this as an add-on developer that uses that colon notation, that wasn’t your problem

That is odd that it works for you? I do specify my prefs in a module file, but I don’t see how that is relevant but other than that I’m doing the exact same thing as the reference states.
I do not seem to be the only one that experienced this issue since I found the answer here: