# Add-on Dev: How to iterate the properties of a type and read/write values

I'm wanting to iterate properties and get/set values. Example code:

for prop in self.rna_type.properties.keys():

# get property name
name = str( prop )

# skip properties if first ident character is lower case (auto added properties)
if name[0].islower():
continue

# assign new value
self[name] = value


Edit note: There was no need for me to convert prop into a string with str() at the top of this loop. All elements inside of keys() are identifier strings.

• If I'm understanding you right, you could simply iterate through all properties and check if their values are of type bool. If they are, then set them to the desired value. – Robert Gützkow Sep 22 '19 at 14:40
• @rjg: Yeah, that's what I'm after. I'm just not sure how to use that object/list. I'm currently trying to use dir() to figure it out, but looking for any type of information about dealing with them. Primarily what each member variable represents. – Robert Sep 22 '19 at 17:11
• Annotations? Suggested here: blender.stackexchange.com/a/152816/31447 – brockmann Sep 22 '19 at 17:57

>>> settings = C.scene.my_addon

• Think I'm finally starting to understand how some of this works. So keys() is just a list of property identifier strings. values() is a list property values, and items() is sort of a combination of both. When you showed me __annotations__ before, I assumed it was some component specific to Blender's preference class. A specific nested type. That's on me, sorry. Also appreciate the usage example. – Robert Sep 22 '19 at 22:44
• Glad I could help @Robert Yep, keys() returns the keys and values() the values of an usual key-value pair (aka dict). – brockmann Sep 23 '19 at 20:24