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()
prefs.active = state
for coll in ['redthings','greenthings','roundthings','otherthings']:
    collname = prefs[coll]
    if collname not in bpy.data.collections.keys():
        newcoll = bpy.data.collections.new(name=collname)
        bpy.context.scene.collection.children.link(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
get_type_hints()

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

Beq.

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.