How to add an Empty to all selected objects?
For Blender &gt;2.80 this will work.
Select all your objects and run this in the scripting panel.
import bpy

for object in bpy.context.selected_objects:
    obj_loc = object.location
    new_empty = bpy.data.objects.new( &quot;empty&quot;, None )
    new_empty.location = obj_loc
    object.parent = new_empty # swap this line around to parent the other way
    object.matrix_world = object.matrix_parent_inverse
    bpy.context.scene.collection.objects.link( new_empty )
    

This will create new emptys at the object origins of all the selected objects, parent the object to the empty and remove any offset between the object and the empty.