I have a set of meshes loaded to the scene.
When I execute following script I wrote, the modifiers collection of the obj always stays empty. Where is my error?
import bpy for obj in bpy.data.objects: print(obj) bpy.context.scene.objects.active = obj print(bpy.context.scene.objects.active) bpy.ops.object.modifier_apply(modifier='DECIMATE') print(len(obj.modifiers))
Note that I check if the active object was set, and the first two prints always print exactly the same. But the print(len(...)) always prints a 0 and in the UI the modifier does not show up.
All solutions for similar problems I found only suggest to set the active object which I did.