Blender 2.80 AddonPreferences/annotations

Hi all,
I’m updating an Addon to 2.80 and switching all my properties to be annotations as per the instructions.
however I have some code that would ideally loop through a series of settings and take a similar action on each one.

prefs = get_addon_preferences() = state
for coll in ['redthings','greenthings','roundthings','otherthings']:
    collname = prefs[coll]
    if collname not in
        newcoll =

This will fail because prefs does not act as a collection class, there seems to be no simple way to iterate over the set of properties without using stuff from “typing”

collname = prefs.__annotations__[coll]
or something like

I suspect I am over thinking this and missing the obvious solution.
Any thoughts?


Do you want to get the property or the value stored in the property?
For the latter I suggest you use getattr(prefs, coll).

1 Like

Perfect Jacques, that’s exactly what I needed, thank you.
The route I was following just gave me the Property itself.