https://python-evdev.readthedocs.io/en/latest/
You find out what the touch events are (use evtest or script your own tester), and then you open a uinput device and send those events to it.
As a demonstration of how to use it: this sends a press of the "A" key on the keyboard each time I press the "A" key on my gamepad. I can start it, switch to a text editor m, press “a” on my gamepad, and watch “a” appear in the text editor.
Code:
#!/usr/bin/env python3
import evdev
# determine this before running the program
gamepad = '/dev/input/event6'
dev = evdev.InputDevice(gamepad)
with evdev.UInput() as ui:
for event in dev.read_loop():
if (event.code == evdev.ecodes.BTN_A):
ui.write(evdev.ecodes.EV_KEY, evdev.ecodes.KEY_A, event.value)
ui.syn()