Change dynamic text multiple times [SystemError]

Hey,

I’ve got a text object that should change multiple times using modules. So for example:

import bge

scene = bge.logic.getCurrentScene()
dynamicText = scene.objects["Text"]

#print(dir(dynamicText))

def walk():
    dynamicText.text = "you can walk"
    
def jump():  
    dynamicText.text = "you can jump"

The first function runs without any problem, but when the second function is called by a sensor the text doesn’t change and i get the following error in my console:

Python script error - object 'HUDcontroller', controller 'Python1':
Traceback (most recent call last):
  File "…", line 14, in jump
SystemError: Blender Game Engine data has been freed, cannot use this python variable

Is it even possible to change a text multiple times? What am I doing wrong here?

PS: Is there any documentation about it? I can’t find any

scene.objects[“Text”] does not exist in the scene anymore

So…? I can change a text object only once?
There is no alternative way to change it multiple times?

Ok, I’m sorry - It seemed to remove the Text ombject after I removed the overlay scene - I wasn’t aware of that.
Keeping the scene “alive” let’s the text object change infinitely