Automation script for Android with getPixelColor and image recognition

Hi, there. So I’ve got a bit of a headscratcher and google has not been very helpful to find the answers I need, so thought I might as well ask here.

I have made an automation script using AHK, which I run from windows, for an android app that I run from within Bluestacks. The script requires pixel and image recognition functions (gonna refer to is as PIR henceforth) and then sends simple taps at coordinates, nothing too fancy. I was curious about making an equivalent that can run from within Bluestacks itself (and possibly iOS compatible too), but AHK does not support Android, so I’ve been looking for another automation tool with PIR that could help me accomplish it.

There are several automation apps for Android but I have found none that have PIR as well as an easy way to code it through a script, they are usually flow UIs that don’t seem as efficient to me as good old text editing. Googling for AHK analogues that are compatible with android comes up with myriad results, but its hard to tell whether they have PIR and can be easily text edited, so if anybody has any suggestions, I’m all ears.

In my research I have also found Kivy (https://kivy.org/#home), which apparently would allow me to use Python and its PIR library to do it, although as a relative beginner at programming, I don’t understand what Kivy actually does, how it makes Python work with Android and if the PIR libraries would also become compatible with Android. Could anyone ELI5 to me how it would work? Assuming it is a viable solution at all, that is.

Alternatively, I have also considered learning Kotlin, but from googling I couldn’t find if it has any PIR capabilities or libraries.

And finally, does anybody know if running such a script from within Bluestacks itself through any of the above (or other) methods would allow the PIR and inputs to work within Bluestacks even while it is in the background and I do other stuff in the computer?