For example I have created a mesh (without using a code), how can I use the mesh in the script like I usually add a primitive object?
Maybe somewhat like bpy.ops.mesh.myMesh_add() ??
And I am sorry for grammar and (maybe) mistaken word.
you gotta turn it into an operator
have a look at the add mesh extra objects script collection, they use different techniques to do this
I'm sitting, waiting, wishing, building Blender in superstition...