Reading properties out of the BGE that change during the course of the game

I’ve created a text object.
I have created a few logic bricks that allow me to change the value of the text in response to the keyboard. For this I have created a Text Game Property for it in the logic editor.

This works. The text starts at “0.5” and changes values based on keyboard input.

I’d like to read the current value of the text in python at arbitrary times.

The following code reads the original default value, but does not get the current value that changed based on keyboard input:

bge.logic.getCurrentScene().objects['mytextobject'].text

Does anyone know how to get the current value of the text object? (or should I say “text game property”?)

I’ve tried also defining a game property “prop” and updating that value. When I show the properties in debug mode I can see the property is changing, but calls to:

bge.logic.getCurrentScene().objects['mytextobject']['prop']

always only returns the original value, not the current value of the property.

cont = bge.logic.getCurrentScene()
own = cont.owner
textObject = own.scene.objects['TextObject']

#to read
value = textObject.text
print(value)

#to write

textObject.text = textObject['prop'] 


btw there is a blender / bge discord and the game engine section of this forum is also a good place to get help.

discord - Blender Talk, talk, talk. What did you expect? - Invite > https://discord.gg/blender <

Thanks for the reply! It was helpful to know that I was on the right track. I finally figured out what I my problem was. I am feeding input to the model from another process via HTTP requests, so when I made that call to bge.logic.getCurrentScene()… I was doing so from a separate process that was handling the HTTP request coming into blender, and that process was not seeing an up to date version of the property. I have to pipe values between the HTTP request over a multi processing manager object (which I was already doing for other values).

Getting the HTTP server to work under blender wasn’t easy. If anyone else finds this thread and is interested in doing so I had to run the python HTTP server in a separate process using multiprocessing.Process, and I passed in a multiprocessing.Manager().Array with the data I need to sync back and forth between blender and the HTTP requests. Then I ran an always logic brick to do an update in blender that reads from this array.