I've seen that somewhere here in BSE, but I am not able to find it again:
Is there a Python script (or addon or operator) which generates a script into a text block able to recreate a given mesh (I mean here with the wanted static data inside, not simply copying the mesh)?
I could do it myself, but if a script already exists, it could be much more complete than I am able to do (for instance having options, such as about UV map, object's rotation and scale, modifiers, materials, etc.).