Copy all attribute and value of object

Hi, how can i “copy” all the attribute and value of an object and save it to a dictionary?
for example i have a cube, and i want to get all the attribute that he have (name, data, etc…). so i can then use it later?
image

not really sure why you’d need to copy everything, but here you go

results = {}

for attr in dir(bpy.context.active_object):
    results[attr] = getattr(bpy.context.active_object, attr)

be aware that caching references to objects can lead to access violation crashes if you try to access them later and they are not in the same memory location… this is why PointerProperty exists.

1 Like