How to iterate over custom properties? I have a number of custom string properties that I added to my scene with:

bpy.types.Scene.prop1 = bpy.props.StringProperty()
bpy.types.Scene.prop2 = bpy.props.StringProperty()
# etc...


I want to be able to iterate over these properties to change their values.

I was hoping I would be able to do something like this:

for prop in bpy.types.Scene:
    prop = "new value";


This doesn't work but I would be iterating over all Scene properties instead of only mine anyway.

I also tried adding my properties' names to a list so that I might be able to access only my custom properties and not all the scene properties:

prop_names = ["prop1", "prop2", etc...]


But then I didn't know how to use these, I was hoping to do:

for prop in prop_names:
    bpy.types.Scene. + prop = "new value";


This also didn't work. So how might I achieve something like this?
There are a few ways to use Python to inspect an objects properties, but in this case you're best off using getattr, setattr.

In the case you describe I think the best option is to store a list of properties,
mainly because there isn't a good way to know which properties you created. (Blender doesn't track a properties owner).

for prop_id in prop_names:
    setattr(scene, prop_id, value)


... for completeness, to copy scene_src -&gt; scene_dst

for prop_id in prop_names:
    setattr(scene_dst, prop_id, getattr(scene_src, prop_id))




Note, theres nothing spesific to custom propertes here, this is typical Python and world with any properties (called attributes in Python)