How do i integrate python script with front-end for computation?

I have 2 python scripts 1)filescript.py 2)userfile.py

I want that user uploads the userfile.py through frontend and the computation will be done between userfile and filescript and the output will be visible on website.

userfile.py is the file that user will upload and contains:

def sumitup(a):
    a=a+120
 return a

filescript.py is the file that we will have with us and contains:

import userfile

def powadd(s):
   p=s**5
return p
if __name__ == '__main__': 
   a=50
   s=getarr(userfile,sumitup)(a)
   p=powadd(s)
   print(p)     

How can i integrate frontend and python script for computational part, considering that i am going to use react for front-end but also open for any better suggestion . Any resource or refrence will be helpful
Thanks

I would recomend that you do watch this:

1 Like

Thanks @KittyKora this is probably the best tutorials i have seen so far.