Update pre render handler

hi, I want to set the output name of the render and add to it the name of the active camera.
I try to use the “pre_render” handler, but it does not work well (for example - in frame 1 the active camera is “cam_1” and now I’m on frame 4 with the “cam_4” as the active camera, and if I press the render button, the first image, that will be rendered from the “cam_1” will get the name “cam_4”)

You could assign the name of the active camera to a separate variable and use that to build the names of rendered frames… instead of asking active camera each time a frame is rendered.

From what you’ve said, I’m assuming you’re doing it like this (keep in mind, this is pseudo code and please excuse the lack of indents):
for frame_to_render in frames_to_render:
rendered_frame.xxx = active_camera.name

Instead, I’m suggesting you do this:
camera_name = active_camera.name

for frame_to_render in frames_to_render:
rendered_frame.xxx = camera_name + frame.xxx

I don’t understand why it should work if I give the name to a variable…
and what I do is to use a handler instead of the loop on all the frame, and with the handler, i check before the render the name of the active camera and then rename the filepath

The questions you’re asking imply (to me) that you aren’t familiar with basic programming practices. I’d suggest you learn those first and then you’ll understand my reply.

Here’s a curated list of Python courses for beginners. They’re all free, so you can try them all to find one you click with.

You’re right that I’m not an expert programmer, but I think I know enough to do what I need most of the time. it was helpful if you could help me instead of giving me useless links…

A lack of gratitude won’t motivate me to help. Bye.

so I found a solution to the problem if somebody will need it in the future…
the problem was because the active camera not change in the “pre render” handler, it happens in the “pre frame handler” after the pre render…

so your solution not work, and your “help” also not help… so thx for nothing