adding 2 curves from python, translate individually

I add curves from points using this function:

def curveFromPoints(coords,name):
    # create the Curve Datablock
    curveData = bpy.data.curves.new(name, type='CURVE')
    curveData.dimensions = '3D'
    curveData.resolution_u = 2

    # map coords to spline
    polyline = curveData.splines.new('NURBS')
    polyline.points.add(len(coords))
    for i, coord in enumerate(coords):
        x,y,z = coord
        polyline.points<i>.co = (x, y, z, 1)

    # create Object
    curveOB = bpy.data.objects.new(name, curveData)
    curveOB.location = (0,0,0)

    # attach to scene and validate context
    scn = bpy.context.scene
    scn.objects.link(curveOB)

when adding several curves, I can rightclick-select the curves individually, but when I try to translate, all curves translate together.
[I]
How can I translate each curve individually?

I’m a beginner in blender and think its a simple missunderstanding on my side, but could net solve this reading through the web.

Edit: When I rightclick in the right pane on the curve and use ‘select hierarchy’ on one curve indivudual transformation works. Is this the intended way of doing this?

I have another question: how would i need to adapt the above code in order to get a colsed curve(last point connected to the first one)?

I can’t seem to duplicate the behavior you’re struggling with. Perhaps you could upload a .blend with the curves in the broken state. And maybe you should explain how you’re calling this function in your script.

I ran this code and the curves translated, scaled, rotated as expected:

import bpy

coli = ((0,0,0),(1,1,1),(2,2,2),(3,3,3),(4,4,4))


def curveFromPoints(coords,name):
    # create the Curve Datablock
    curveData = bpy.data.curves.new(name, type='CURVE')
    curveData.dimensions = '3D'
    curveData.resolution_u = 2


    # map coords to spline
    polyline = curveData.splines.new('NURBS')
    polyline.points.add(len(coords))
    for i, coord in enumerate(coords):
        x,y,z = coord
        polyline.points[i].co = (x, y, z, 1)


    # create Object
    curveOB = bpy.data.objects.new(name, curveData)
    curveOB.location = (0,0,0)


    # attach to scene and validate context
    scn = bpy.context.scene
    scn.objects.link(curveOB)
    
for i in range(0,3):
    curveFromPoints(coli, 'curveName')

HI, thanks for your post.
I restarted blender and started again from an empty file, now I can not reproduce the behaviour.
I will have an eye on it in case it shows up again.

I also solved my question about closing the curve: add

polyline.use_cyclic_u = True