Adding a Hook to a Nurbs Path with Python
Avoid edit mode if you can.
Suggest this can be done via API calls with no operators. Have lazilly added the empties with the op, add them as you have other objects if so desired.
Test script adds an empty hook to each end of your poly.  Note have used NURBS as per question title. To have end points set the use_endpoints_u and v properties of the spline.
import bpy
from bpy import context


# Add Path
coords_list = ([[0,0,0], [1,0,0]])
path = bpy.data.curves.new('_path', 'CURVE')
path.dimensions = &quot;3D&quot;
spline = path.splines.new(type='NURBS')
spline.points.add(len(coords_list)-1)
spline.use_endpoint_u = True
spline.use_endpoint_v = True
path_ob = bpy.data.objects.new('_Path', path)
for i, (p, new_co) in enumerate(
        zip(spline.points, coords_list)
        ):
    p.co = (new_co + [1.0]) # (add nurbs weight)
    bpy.ops.object.empty_add(
        location=new_co,
        )
    hm = path_ob.modifiers.new(
        name=f&quot;Hook{i}&quot;,
        type='HOOK',
        )
    hm.object = context.object
    hm.vertex_indices_set([i]) 


context.collection.objects.link(path_ob)