Is there a way to select different image in the UV/Image editor using the api?

what I woud do is to select a different image in the UV/Image editor from the ones already opened depending on the selected object in the 3d view. I wanted to know if there is a command in the api to select a different image. Being in the right context or not wouldn’t matter, it could also be accessed through the space-bar search menu. Not related: since 2.62 increased the maximum objects’ name lenght i started using longer ones. Is it a bug bpy.ops.object.select_pattern(pattern=‘objectname’) doesn’t work with names longer than 32 characters?

nvm found it.[2].areas[4].spaces[0][0]

For others who look for this information: The method above depends on how the user has setup the screens in Blender. In some scenes UV/Image Editor might be in index “2” of screens[], on other scenes it might not. User could even have a scene where the UV editor is not open at all.

In object mode, one can assign textures properly like this:

>>> for ii, i in enumerate(
...     if ii % 2 == 0:
...         i.image =['']

This example sets the texture of every other face to the image “”, which was previously imported (using the current object)

Is it a bug bpy.ops.object.select_pattern(pattern=‘objectname’ ) doesn’t work with names longer than 32 characters?

It is, reported and fixed in SVN. You can fix it yourself for your current installation if you want:

Go to Blender folder
Navigate to \2.63\scripts\startup\bl_operators
Open in text editor
Search for maxlen=32
Replace by maxlen=63
Save and restart blender