Update texture between render layers?
I'm not 100% sure we can guarantee the order that layers are rendered in but it does appear to be the order they are listed in the scene layers list. With that the easiest way would be to use a file output node to save the first layers to file before the final layer is rendered.



The bpy.ops.render.render() operator accepts a parameter for the render layer, this is what is used by the node editor. A script could render one layer at a time, saving the layer to a file ready for the next layer. Note that you are walking into the chicken and egg problem, the render you do for the material will not have a material until you finish the render to give it a material. You should make sure that the camera used for each material does not contain an area that relies on any future materials to be generated.

scn = bpy.context.scene
objs = bpy.data.objects
scn.camera = objs['layer1_cam']
scn.render.filepath='//layer1.jpg'
bpy.ops.render.render(layer='layer1', write_still=True)
scn.camera = objs['layer2_cam']
scn.render.filepath='//layer2.jpg'
bpy.ops.render.render(layer='layer2', write_still=True)
scn.camera = objs['final_cam']
scn.render.filepath='//final_render.jpg'
bpy.ops.render.render(layer='final_layer', write_still=True)


If you are placing the renders as a flat plane on the final render, you can automate it without a script by using multiple scenes, each scene can use a different camera, so they aren't all rendering the same thing. You duplicate the scene with the link objects option so that any changes are seen in each scene and to keep each scene in sync when adding new objects be sure to use &#9096; CtrlL->Objects To Scene->Scene... to add them to each scene.

Once the scenes are setup, add a new render layer node for each scene, use scale and translate nodes to position the layer and alpha over to combine them. You can either use the pass index for an object to get a mask matching an entire object or the pass index of a material to get a mask matching a material, which allows you to apply the material to selected faces of an object. The ID Mask node is then used to get the mask. Enable the object or material index in the render passes to have it available in the compositor.

Now when you render the final scene, all the other scenes will get rendered and be composited onto the final image.