I've been using SikuliX [1] instead of AHK for a while now, only downside is that it uses jython so it's stuck on 2.7, but I don't use it for anything complicated enough that it really matters. Also I mainly use it for long running, rarely used automation, so I'm not sure how it would compare in terms of responsiveness for tasks like text expansion.
Also I did a quick search and I assume this [2] is the library you mentioned?
Also I did a quick search and I assume this [2] is the library you mentioned?
[1] https://github.com/RaiMan/SikuliX1
[2] https://pypi.org/project/ahk/