Skip to main content
2 of 2
added 262 characters in body

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)

To add modifier (wireframe) for all selected objects:

import bpy

for ob in [ob for ob in bpy.context.selected_objects if ob.type == 'MESH']:
    mod = ob.modifiers.new(name='Wire', type='WIREFRAME')
    mod.thickness = 0.02 # SET THIS