How to add a Line between two moving Objects with Python? I'd like to add a line between two moving objects with python.
For example if I have two cylinders...



I want that light blue line between the two 3D object (it could be a cylinder also). It has tree parts:


and 2. there is one shorter line which comes from the side of the cylinders (not from the top or the bottom), and the other ends which are marked with red arrows, 'point' to the other object.


From the top view:




The third part is connecting these points.
And if I move these objects, or rotate them, I'd like to have the line with the same features:




I would like to add the line with a Python script.
I've tried many things, but couldn't solve the problem yet.
This script will generate a simple single edge mesh, whose verts are hook connected to two pre-existing objects (the cylinders C1 and C2 in this example), which will also work simple animations of these two objects:

import bpy, bmesh
C = bpy.context

# Reference two cylinder objects
c1 = bpy.data.objects['C1']
c2 = bpy.data.objects['C2']

# Create new connector mesh and mesh object and link to scene
m = bpy.data.meshes.new('connector')

bm = bmesh.new()
v1 = bm.verts.new( c1.location )
v2 = bm.verts.new( c2.location )
e  = bm.edges.new([v1,v2])

bm.to_mesh(m)

o = bpy.data.objects.new( 'connector', m )
C.scene.collection.objects.link( o )

# Hook connector vertices to respective cylinders
for i, cyl in enumerate([ c1, c2 ]):
    bpy.ops.object.select_all( action = 'DESELECT' )
    cyl.select_set(True)
    o.select_set(True)
    C.view_layer.objects.active = o # Set connector as active

    # Select vertex
    bpy.ops.object.mode_set(mode='OBJECT')
    o.data.vertices[i].select = True    
    bpy.ops.object.mode_set(mode='EDIT')

    bpy.ops.object.hook_add_selob() # Hook to cylinder

    bpy.ops.object.mode_set(mode='OBJECT')
    o.data.vertices[i].select = False 

o.modifiers.new('Skin', 'SKIN')
bpy.ops.object.select_all( action = 'DESELECT' )