Skip to main content
1 of 2

This will do what you want: Applies modifiers for all selected objects:

import bpy
import bmesh

for ob in [ob for ob in bpy.context.selected_objects if ob.type == 'MESH']:
    b_me = bmesh.new()
    b_me.from_object(ob, bpy.context.scene)
    b_me.to_mesh(ob.data)
    b_me.free()
    
    for mod in ob.modifiers:
        ob.modifiers.remove(mod)