Geometry change with imported module (scripting basics)

another boring nooby question from me :}
For example I have main script and imoprted module. Inside main script i create a Mesh with:


Then I pass Guid of this Mesh to module function, and select it with

My_Mesh_Ref = sc.doc.Objects.FindGeometry(My_Mesh_Guid)

Then this imported function makes some modifications with this Mesh Reference. I’m sure that they are because I perform an inspect for that.
After that while making just the exact same inspection but in the main script it turns out, that the original mesh remains the same.
I’m just missing something important… how do I update original Mesh with its modified reference?

I seem to have found a way to achieve the desired result: just create a new Mesh from this modified reference, and delete the old one.
But I’m not sure if this is the most graceful solution.
However, it works, so be it.

I am very sorry to bore you with ridiculous questions, and yet I would be very grateful if someone could explain to me such a simple thing:
When I select an object using sc.doc.Objects.FindGeometry and get its reference, it means that I get a kind of copy of the object, but not the object itself !? Therefore, I need to commit all changes through deleting the old object and creating a new one from this modified reference?
For example, if I changed coordinates of a vertex in a Mesh, is this the correct way, or there is another better and correct way to do it?

Not really, you get the unique identifier of the object, which keeps track it, much like a memory address keeps track of objects in memory.

Can you post an example of what you try to do?

How do you currently do it? It’s important not to copy the vertex into a new variable and apply the changes there, but apply the changes directly to the mesh itself.

Heres my try:

Mesh_Ref = Rhino.DocObjects.ObjRef(Mesh_Guid)
Mesh_Itself = Mesh_Ref.Mesh()
print(Mesh_Itself.Vertices[1])  # prints 1,1,1
Mesh_Itself.Vertices.Item[1] = rhg.Point3f(100, 100, 100)
print(Mesh_Itself.Vertices[1])  # prints 100,100,100

but viewport Mesh remains. I also tried this kind of “direct surgery” variant, but without succes:

Rhino.DocObjects.ObjRef(Mesh_Guid).Mesh().Vertices.Item[1] = rhg.Point3f(100, 100, 100)
Mesh_Itself.Vertices.Item[1].X = 100  # does not SET
print(Mesh_Itself.Vertices.Item[1].X)   # but gets fine, prints 1

though it says “Gets or sets the X (first) component of the vector” here