[SOLVED] python script per frame when cycles is rendering?

I can execute one python script per frame (main loop), when Cycles rendering are working?.
Thanks.

I want to change the mesh like this (per example pseudo code):

i = 0
while (cycles is rendering){
    bpy.data.objects['Cube'].data = bpy.data.objects[Cube.i].data
    i += 1
}

I would like try to do a lod (Level Of Detail) script for Cycles.
I need measure objects and camera per frame.

You are looking for “Handlers” - check it out: https://docs.blender.org/api/blender_python_api_2_60_6/bpy.app.handlers.html

Thanks!! :smiley:

Preliminar tests:
https://github.com/zebus3d/varios_blender/blob/master/switch_object_mesh_by_distance_python_LOD_00.py