Creating physics attachment in standalone cloth simulation

Hi,
I am trying to create a standalone simulation of a robot manipulating a cloth, and I have some doubts about how to create the attachment between the Robot and the cloth.

I can create an attachment from the GUI and save the scene in a .usda; however, I want to change the attachment at the beginning of each simulation. Secondly, when working with robots, I was not able to change the robot joint states from the GUI (I am probably missing something), so I wish to do everything within the standalone application.

I looked into the documentation but could not find how to create the attachment from Python.
I have found some documentation from PhysX (Omni PhysX — omni_physics 104.2 documentation) where some methods of the PhysX.AttachmentAPI are described. I suppose that by using them in the right order, I should be able to do the equivalent of Create->Physics->Attachement from the GUI

Am I in the right direction? Is there a code snippet to look into?

I have found by myself the solution code is available in the demo “Deformable Body Attachments”.
Here is a snippet from the demo

attachment_cd_left_path = blob_left_mesh.GetPath().AppendElementString("attachment")
attachment_cd_left = PhysxSchema.PhysxPhysicsAttachment.Define(stage, attachment_cd_left_path)
attachment_cd_left.GetActor0Rel().SetTargets([blob_left_mesh.GetPath()])
attachment_cd_left.GetActor1Rel().SetTargets([cube_left_prim.GetPath()])
PhysxSchema.PhysxAutoAttachmentAPI.Apply(attachment_cd_left.GetPrim())