I know this may not be perfect. We have a testing application using python 2.7. We leverage the windows scripting host to send keys. I have not had time to port anything over to python 3, but this might get you in the right direction. It should be pretty similar.
import win32api
import win32com.client
shell = win32com.client.Dispatch("WScript.Shell")
shell.Run("app")
win32api.Sleep(100)
shell.AppActivate("myApp")
win32api.Sleep(100)
shell.SendKeys("%")
win32api.Sleep(500)
shell.SendKeys("t")
win32api.Sleep(500)
shell.SendKeys("r")
win32api.Sleep(500)
shell.SendKeys("name")
win32api.Sleep(500)
shell.SendKeys("{ENTER}")
win32api.Sleep(2500)
Here is a list of the send key commands for Windows Scripting Host.
Update
This uses pywin32. It is installed by default in the ActiveState version of python (which is the one I am using). I am not sure, but I do not believe, that it is installed by default in the plain vanilla version of python.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…