CreateOffsetAlignment using python:

Hello,
I am trying to create offset alignments. But I keep getting an error.
can you please check my code?

Script

def CreateOffset():
global adoc
global editor
global civdoc
result =

with adoc.LockDocument():
    with adoc.Database as db:
        with db.TransactionManager.StartTransaction() as t:
            # Place your code below
            civildoc = CivilApplication.ActiveDocument
            Ids = civildoc.GetAlignmentIds()
            Alignments = []
            
            for id in Ids:
                al = t.GetObject(id, OpenMode.ForRead)
                Alignments.append(al.Name)
            
            if Alignments:
                # Take the first alignment for the demonstration
                first_alignment = Alignments[0]
                al = t.GetObject(Ids[0], OpenMode.ForRead)  # Get the alignment object
                
                offset_name = "Subhi"
                offset_distance = 1
                right_offset_id = al.CreateOffsetAlignment(offset_distance)
                right_offset_al = t.GetObject(right_offset_id, OpenMode.ForWrite)
                right_offset_al.Name = offset_name
                right_offset_al.StyleName = "Offsets"
                result.append(offset_name)
            
            # Commit before end transaction
            t.Commit()
            
return result

Assign your output to the OUT variable.

OUT = CreateOffset()

Error:
image