How to hook a vertex of a curve to a certain object?
If you know the objects by name (names are unique), you can get them by global data access:
curve = bpy.data.objects[&quot;BezierCurve&quot;]
hook = bpy.data.objects[&quot;Empty&quot;]

Or even better per scene in context if you'd like to turn this into an operator later on:
curve = bpy.context.scene.objects.get(&quot;BezierCurve&quot;)
hook = bpy.context.scene.objects.get(&quot;Empty&quot;)

To add a modifier to an object, with its name and type:
modifier = curve.modifiers.new(&quot;Hook&quot;, 'HOOK')

Then the modifier has its own specific attributes and methods
For hook, as described here:
The target object:
modifier.object = hook

And the hooked vertices. a bezier curve handle has 3 points, so you can set indices with:
handle_index = 0
index_from = 3 * handle_index
index_to = index_from + 3
modifier.vertex_indices_set( range(index_from, index_to) )

All together:
import bpy

curve = bpy.data.objects[&quot;BezierCurve&quot;]
hook = bpy.data.objects[&quot;Empty&quot;]

modifier = curve.modifiers.new(&quot;Hook&quot;, 'HOOK')
modifier.object = hook

handle_index = 0
index_from = 3 * handle_index
index_to = index_from + 3
modifier.vertex_indices_set( range(index_from, index_to) )