Setting up a PythonController object in script: howto assign text value??

Setting up a PythonController object in python, I naively tried to
direct it to my gamelogic python file like this

>>> import bpy
>>> obj=bpy.data.objects[“my_object”]
>>> cont=obj.game.controllers[“my_cont”]
>>> cont.text = “my_game_script.py”

and get this error:

Traceback (most recent call last):
File “<blender_console>”, line 1, in <module>
TypeError: bpy_struct: item.attr= val: PythonController.text expected a Text type, not str

How can I make a text type for the file name? Of course, I know how to do it in the GUI, but I need to do it in a python script.

i’ve had the same problem. for future visitors…

cont.text = bpy.data.texts['...']