# Handler frame_change_post causes strange side effects in render

Related to this issue. I created a new .blend file for a test case. A moving object Lift is parent to Camera and Text objects.

The lower Text is updated every frame to show the altitude of the Lift. As adviced by user lemon (see the link above) I set up this script:

import bpy

def frame_handler(scene,depsgraph):
print(depsgraph)
obj = scene.objects['Lift']
obj = obj.evaluated_get(depsgraph)
z = obj.location[2]
scene.objects['DynamicText'].data.body = 'z = {:06.3f} m'.format(z)

bpy.app.handlers.frame_change_post.clear()
bpy.app.handlers.frame_change_post.append(frame_handler)


The idea is that camera films both the scenery and the altitude text. It works fine in viewport:

However, the render result is strange. The Text moves vertically in an unintentional way:

Blender file:

Edit. Blender version is 2.81.16

• It seems that accessing some_obj.data somehow causes it. Looks like it breaks the parenting with Lift (although, some_obj.parent keeps printing 'Lift'). (ie, scene.objects['StaticText'].data.extrude = .01 breaks it) Feb 27 '20 at 13:43
• As mentioned prior, this appears buggy at the moment. (Treading on off-topic) And repeating: Meanwhile If you wish to render animation, render as single image in a loop changing frames. This way you will get a render that matches viewport display. Feb 27 '20 at 13:58
• A work around: def frame_handler(scene,depsgraph): obj = scene.objects['Lift'] obj = obj.evaluated_get(depsgraph) z = obj.location[2] altitude = scene.objects['DynamicText'] text_z = altitude.location[2] altitude.data.body = 'z = {:06.3f} m'.format(z) altitude.location[2] = text_z Feb 27 '20 at 14:51
• Nice workaround @lemon. It's simple and does the trick but I certainly wouldn't have come up with it. I think it's a valid solution. Feb 27 '20 at 16:52
• @user3202179 thanks. Won't write an answer about it, as said by batFinger there are problably some buggy aspects in this version and so an answer is not valuable except for make it working for you. Feb 27 '20 at 16:55