How to switch texts in Text Editor by script
You can change it via bpy.types.SpaceTextEditor.text

So if you run an operator from the text editor you can change it in the execute method like this:

def execute(self, context):
    context.space_data.text = bpy.data.texts['your_text']


Otherwise you have to find the text area in screen.areas (given there is a text editor in the screen):

for area in context.screen.areas:
    if area.type == "TEXT_EDITOR":
        break
    else:
        raise RuntimeError("Nothing found")

area.spaces[0].text = bpy.data.texts['your_text']