I'm trying to bind a Mesh Deform modifier to an object, but when I do that via script it creates one, sets the object to deform with (here child). But when I call bind from the script I does not bind it instantly. I have to select another object with the mouse (some scene update or context switch I guess) then the modifier suddenly gets bound.
A scene update does not change the behavior.
parent.modifiers.new(name="MeshDeform1", type='MESH_DEFORM')
parent.modifiers["MeshDeform1"].object = child
bpy.ops.object.meshdeform_bind(modifier="MeshDeform1")
How do I tell Blender to update the new modifier?
Update: When I explicitly set the object as active at the beginning, the user Interface shows the button "unbind" which should mean the modifier is already bound, but actually the modifier does not do it's job. When I now click unbind and bind again it works as expected.