Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Let's say I have 2 objects: 1 empty and 1 cube. How could I create a "Copy Location" constraint for the empty, so it follows the cube's movement?
scene = bpy.context.scene
obj = scene.objects['Cube']
empty = scene.objects['Empty']
constraint = obj.constraints.new('COPY_LOCATION')
constraint.target = empty
Required, but never shown