I can't apply the modifier programmatically via Python, but clicking the GUI button works.

Some answers on this site say bpy.ops commands usually demand the current active object be proper.

>>> bpy.context.scene.objects.active

tells me my active object is proper.

But still, I get

>>> bpy.ops.object.modifier_apply(apply_as='DATA')

Again, clicking the GUI button works without problems. How may I do it via script?


This command requires you to give it a modifier name.


This will apply all modifiers. Note, this is a operator from addon 'Modifier Tools'. You have to have this addon enabled to be able to use that command.

| improve this answer | |
  • $\begingroup$ AttributeError: Calling operator "bpy.ops.object.apply_all_modifiers" error, could not be found $\endgroup$ – Sibbs Gambling Jun 20 '17 at 4:31
  • 1
    $\begingroup$ Sorry, that command is a subtool from the addon 'Modifier Tools'. Do you have this addon? If you do, enable it and try again. If not, you have to get this addon, or just upgrade your blender to the newest version. Then make sure it's enabled. $\endgroup$ – TeaCrab Jun 20 '17 at 6:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.