Modifier added from Python operator not being applied My operator duplicates the active object, adds a solidify modifier to it, then applies it.
When run from my panel it works EXCEPT it does not apply the modifier and I can see it still under the duped object in the Outliner (I can then manual apply it, apparently correctly).
When I run the operator directly from the Python Console it DOES apply.
I've verified that after the duplicate, the new object is active and the sole selected object.
I must being doing something wrong that only manifests in a panel context, but I'm stumped.  Below is the complete test script.
# Blender 2.82a
import bpy

class TestSolidifyOp(bpy.types.Operator):
    bl_idname = &quot;object.test_solidify&quot;
    bl_label = &quot;Test solidify&quot;

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def execute(self, context):
        orig=context.active_object

        bpy.ops.object.duplicate()
        ob = context.active_object

        if orig is ob:   # Just to show orig obj is NOT still active
             return{'CANCELLED'}

        mod = ob.modifiers.new(&quot;Solidify&quot;, 'SOLIDIFY')
        mod.thickness = -1
        bpy.ops.object.modifier_apply(modifier=&quot;Solidify&quot;)

        return {'FINISHED'}

class TestSolidifyPanel(bpy.types.Panel):
    bl_label = &quot;Test solidify Panel&quot;
    bl_idname = &quot;PANEL_PT_tsolid&quot;
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = &quot;object&quot;

    @classmethod
    def poll(cls, context):
        return (context.mode == 'OBJECT')

    def draw(self, context):
        layout = self.layout
        row = layout.row()
        row.operator(&quot;object.test_solidify&quot;)

if __name__ == &quot;__main__&quot;:
    bpy.utils.register_class(TestSolidifyOp)
    bpy.utils.register_class(TestSolidifyPanel)
Override the context.
TBH can't see why this is not working, the properties panel can be fickle, for example with context.object
Suggest two changes, make an override dictionary to be sure to be sure the object known as ob is the one having its modifier applied. Secondly using mod.name to identify the modifier ensures it is the last one added, in case the object has another already.
bpy.ops.object.modifier_apply({&quot;object&quot; : ob}, modifier=mod.name)