An interesting use case, but I doubt the idea to use Python directly in a Mendix application. Without knowing much about the context, it feels better to offload the algorithm to an external provider (such as AWS, Azure, UbiOps) and create an interface.
As an alternative, you could investigate if the model can be converted to the format required to use in Mendix ML Kit (this will be announced later, currently in private beta). This could be the most clean solution.