How to apply modifier on selected objects
To apply an object modifier with the Blender Python API we can use the “bpy.ops.object.modifier_apply” operator. However, it processes only the active object.
If we need to apply a modifier, for example – Subdivision Surface, to several selected objects, we need to make each of them active, and then call the “modifier_apply” operator.