Run Python Functions in frontend [closed]

I know front-end developement with React.js. I want to make a basic web-app where I use some python functions (for example on onClick of buttons etc). These functions would mainly revolve around machine learning (but wont be too complex).

Is there any way to run python functions from React.js apart from ajax queries?

If not, which Python framework should I use to do web development in Python such that I can directly run Python functions as well? I have come across names like Django, Tinkter and Flask but couldn’t figure out what exactly would suit my requirement.