There is no direct option for this but you can create some custom java like this: https://docs.mendix.com/howto/logic-business-rules/extending-your-application-with-custom-java and call the python script from java like described here:
Hi, now I start to learn about programming languages here in Mendix cloud. So, I also want to learn how Integrated Python scripts because now I am starting to learn Python before 2 weeks @CETPA Infotech.
This article might be useful: https://ubiops.com/building-a-low-code-app-powered-by-ai/
It shows how to serve a Python (or R) model and integrate it in a Mendix app.