I have a script that automatically adds an empty as a target of a constrain which works as it should be, but when I run again the script it adds another empty with the suffix .001 and what I would like to is that the target updates automatically with that new empty with the suffix .001 and so on. Is that possible?
import bpy
empty_name = 'MyOwnEmpty'
o = bpy.data.objects.new( empty_name, None )
bpy.context.scene.collection.objects.link( o )
o.empty_display_size = 4
o.empty_display_type = 'ARROWS'
for x in bpy.context.selected_objects:
objs = x.constraints.new(type='COPY_LOCATION')
objs.use_offset = True
objs.target = bpy.context.scene.objects.get(empty_name)