Combining AI/ML with Games - Games receiving input from the host operating system and/or web service calls

This past Spring I worked with some High School Students to build a Raspberry Pi Zero based Arcade Console. One of the students created a game in Arcade MakeCode which we loaded on the console and other students have been playing the game. It seems this was a successful project.

This fall there is a new group of students. They have express interest in 3 code related ideas: 1) Game Development, 2) Sensors (i.e. a Weather Station based on a Raspberry Pi Pico W), and 3) AI/ML/Robotics maybe with speech to text input from a microphone, evaluating this against a trained data set and saying some phrases in response. We may also try some Object Detection. Ideally we could combine these ideas and create an ecosystem for future student groups to continue to expand on. One idea is to display or recommend a certain game based on the ML evaluation of the input. We could probably do this on a Raspberry Pi 4 with Tensor Flow (Lite), a Speech to Text Library and Pygame but I would MUCH rather the students doing game development do this in MakeCode. The Tensor Flow learning curve is step enough and I would rather them not have to learn coding a game from scratch in Pygame. From my understanding of Arcade Makecode games, the generation of the UF2 file is a pretty closed system (i.e. it requires a special OS that does not have internet access or access to data on the OS)

QUESTION: Is there a way to create a game in Arcade.Makecode and copy/paste the generated Python into a .py file on the Raspberry Pi OS (with some modifications)? Can Libraries be installed for these games to run this way? Or are there other ways of using the generated UF2 file on a full Raspberry Pi OS that would allow us to send/receive input from the OS/Python into the game or even launching a specific game based on an outcome in a Python script (i.e. from the ML evaluation).

Thank you for any input you can provide. I do not consider myself a developer and don’t know Python, but I am pretty technical. If you could point me in the right direction, I will experiment with this.

FYI: I have installed Tensor Flow Lite and gotten it to detect the object in a picture (from sample code).