I' ve written the following function to apply a shrinkwrap modifier

def shrinkwrap(obs):
for ob in obs:
    if not ob.type == 'MESH':
    msw = ob.modifiers.new("shrink", type = 'SHRINKWRAP')
    bpy.data.objects["body_2"].modifiers["shrink"].target = bpy.data.objects["body_1"]
    bpy.ops.object.modifier_apply(apply_as = 'DATA')

I've problems with the last row (it is the function that should let me push the apply button shown in the following image )

enter image description here

In this image the target has not been selected, the function selects it correctly.

  • $\begingroup$ Hello, what exactly is your question ? $\endgroup$ – Gorgious Sep 11 '20 at 15:32
  • $\begingroup$ Yes, thank you :) $\endgroup$ – Carmine Buonagura Sep 11 '20 at 16:02