Script that supposed to change value of the text is only working on viewport I have a text object and a scrip that takes an int value from custom property and applies to the text.
The script works in animation preview (User Perspective), but then it comes to rendering script isn't being called out to change value.
import bpy

scene = bpy.context.scene
TextObject = scene.objects['TimerText']
#function that formats string
def TimeCounter(scene):
    value = TextObject.data['time']
    min = int(round(value/60, 60))
    sec = value-(min*60)
    
    TextObject.data.body = 'Time ' + str(min) + ':' + str(sec).zfill(2)

bpy.app.handlers.frame_change_post.append(TimeCounter)
I looked at other results and I applied their examples to my code.
I added this variable in my TimeCounter function, that gets evaluated value from custom property.
eval_text = TextObject.evaluated_get(depsgraph)
and also changed def TimeCounter(scene): to def TimeCounter(scene, depsgraph):
And in the end this script was here to recompile the results,
    bpy.app.handlers.frame_change_post.clear()
    bpy.app.handlers.frame_change_post.append(TimeCounter)
    
def unregister():
    bpy.app.handlers.frame_change_post.remove(TimeCounter)
    
if __name__ == &quot;__main__&quot;:
    register() 

It also works without this long code.
bpy.app.handlers.frame_change_post.append(TimeCounter)

Here's full working code:
import bpy

scene = bpy.context.scene
TextObject = scene.objects['TimerText']

def TimeCounter(scene, depsgraph):
    eval_tex = TextObject.evaluated_get(depsgraph)
    value = eval_tex.data['time']
    min = int(round(value/60, 60))
    sec = value-(min*60)
    
    TextObject.data.body = 'Time ' + str(min) + ':' + str(sec).zfill(2)
def register():
    bpy.app.handlers.frame_change_post.clear()
    bpy.app.handlers.frame_change_post.append(TimeCounter)
    
def unregister():
    bpy.app.handlers.frame_change_post.remove(TimeCounter)
    
if __name__ == &quot;__main__&quot;:
    register()