Modifier added from Python operator not being applied
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)