Scripting - duplicate object with texture and link

Hi everyone,

I would like to create many identical objects using a script, and assign the same UV map to all of them.

I see two possibilities here: either I create the first object with a UV map, and then I need to duplicate the texture along with the objet, or I create similar objects (scaled cubes, in my case) and then I need to create a texture and apply it to all objets.

My problem is that I cannot find the syntax for any of these instructions… Can anyone help me?