#! bpy"""Name: 'rotate.py'Blender: 27xGroup: 'Example: rotation, materials, textures, uv-mapping'Tooltip: 'move an object'"""importbpyimportosimportmathdefuvMapper4Cube(obj):""" Put images on each side of an cube"""# die verwendeten Namen bauennamen={'kopf.jpg':('mat01','tex01'),'boot.jpg':('mat02',' tex02'),'blume.jpg':('mat03','tex03'),'monster.jpg':('mat04','tex04'),'vocaword.jpg':('mat05','tex05'),'telefon.jpg':('mat06','tex06'),}foriinnamen.keys():# new baterialmatname=namen[i][0]ifnotmatnameinbpy.data.materials:material=bpy.data.materials.new(matname)material.diffuse_color=(0,.5,.4)obj.data.materials.append(material)# new texturetexUV=bpy.data.textures.new(namen[i][1],type="IMAGE")image_path=os.path.expanduser("//images//{}".format(i))image=bpy.data.images.load(image_path)texUV.image=image# connect texture with materialbpy.data.materials[matname].texture_slots.add()bpy.data.materials[matname].active_texture=texUVbpy.data.materials[matname].texture_slots[0].texture_coords="ORCO"bpy.data.materials[matname].texture_slots[0].mapping="CUBE"# set a material to a polygonforfaceinobj.data.polygons:print(face.index)face.material_index=face.index# # set a material to a polygon# for face in obj.data.polygons:# print(face.index)# face.material_index = face.indexdefcleanup():# quit edit modeifbpy.ops.object.mode_set.poll():bpy.ops.object.mode_set(mode='OBJECT')# find all mesh objects and deletebpy.ops.object.select_by_type(type='MESH')bpy.ops.object.delete()# delete all materialsforiinbpy.data.materials.values():bpy.data.materials.remove(i)# delete all texturesforiinbpy.data.textures.values():bpy.data.textures.remove(i)# delete all imagesforiinbpy.data.images.values():# delete image (only possible if the image has no user!# except the name is "Render Result"!ifi.name!="Render Result":i.user_clear()bpy.data.images.remove(i)defanim_rotation(obj):obj=bpy.context.active_objectstartanim=0endeanim=222bpy.data.scenes['Scene'].frame_start=startanimbpy.data.scenes['Scene'].frame_end=endeanim# rotate at the z-axisobj.rotation_euler=(0.0,0.0,0.0)obj.keyframe_insert(data_path='rotation_euler',frame=0)obj.rotation_euler=(0.0,0.0,math.pi*2)obj.keyframe_insert(data_path='rotation_euler',frame=100)# rotate at the x-axisobj.rotation_euler=(0.0,0.0,0.0)obj.keyframe_insert(data_path='rotation_euler',frame=101)obj.rotation_euler=(math.pi*2,0.0,0.0)obj.keyframe_insert(data_path='rotation_euler',frame=200)if__name__=="__main__":ifbpy.ops.object.mode_set.poll():bpy.ops.object.mode_set(mode='OBJECT')cleanup()bpy.ops.mesh.primitive_cube_add(location=(0,0,0))obj=bpy.context.scene.objects.activeobj.name='image-as-uvmapping'obj=bpy.context.scene.objects['image-as-uvmapping']uvMapper4Cube(obj)anim_rotation(obj)# switch to the timelineforareainbpy.context.window.screen.areas:ifarea.type=="CONSOLE":area.type='TIMELINE'# Und Animation startenbpy.ops.screen.animation_play()

If you fail to get the result as shown in the video you can download
all files: