How to set uv_layer by script ?

Hello

I have an object with many materials, each of it with a texture.
How can i access the texture slot/Mapping/Map and set the UV map by script ?
I tried it with

import bpy
for mat in bpy.data.materials:
mat.texture_slots[0].uv_layer = ‘UVMap’

but get: AttributeError ‘NonType’ object has no attribute uv_layer.

thanks
testuser

P.S. following seems to work

import bpy
for mat in bpy.data.materials:
for iTextures in mat.texture_slots:
if iTextures is not None:
#print(iTextures.name)
mat.texture_slots[0].uv_layer = ‘UVMap’

nobody?

For some clarification: I create a 3D building with a CAD tool, export it as 3ds file or obj file and import it into blender 2.73a.
After joining the more than one hundred objects i get one single object with many materials with one or more textures each.
In the texture slot “mapping/coordinates:” each texture has “UV” preselected and at “mapping/projection:” “Flat” is preselected. My problem is, that
at “mapping/Map:” nothing is preselected and i have to select the “UVMap” manually for each texture.
After setting the values i want to use the several UVmaps as the source and create one single image/uv map by baking the textures.

So it would be much easier for me, if i could set these values “textureslot/mapping/Map:” by python script.
The mouse tooltip shows “bpy.data.materials[nameoftexture].texture_slots[0].uv_layer” for the field i want to set.
As a total python beginner i don’t know, how to iterate through the textures of the scene to set the uvMap.

Please could anybody help and tell me, how i can do this ?
greetings testuser

So is it solved?

Yes, for me its solved…is there a button for that one, who created the thread to mark it as solved ?