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:
Edit. Blender version is 2.81.16



