
All you need to change in the previous answer so that it would generate cylinder connectors instead of boxes, is setting the Skin modifier to smooth shading, and adding a subdivision surface modifier on top of it.
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
m = o.modifiers.new('Skin', 'SKIN')
## New bit starts here
m.use_smooth_shade = True
m = o.modifiers.new('Subsurf', 'SUBSURF' )
m.levels = 2
m.render_levels = 2
## End of new bit
bpy.ops.object.select_all( action = 'DESELECT' )