bpy.data.objects['temp2'].select=True; bpy.context.scene.objects.active=bpy.data.objects['temp2']; bpy.ops.object.constraint_add(type='CHILD_OF'); context_copy = bpy.context.copy() context_copy["constraint"] = bpy.data.objects['temp2'].constraints["Child Of"]; context_copy["constraint"].target = bpy.data.objects['temp1']; #>>>RuntimeError: Error: Could not find constraint data for Child-Of Set Inverse bpy.ops.constraint.childof_set_inverse(context_copy); print('done');
Everything seems to go as planned until the inverse is set. The error coming out in the console is denoted above. The button can be clicked manually to ‘Set Inverse’ after the script fails at childof_set_inverse() successfully. Is there some reason why yhe constraint data can not be found?