I want to run an external python file
the Django.view code is as follows:
def generate(request):
a=int(request.POST["status"])
b=int(request.POST["level"])
run(['python', 'water.py',a,b])
I have imported this water.py file from my app I want to pass these a and b values to my water.py file so that the water.py file can run in the background and can create a CSV file but I don't know how to pass these value my water.py code is as follows
from time import time
import sys
from __main__ import*
# trying to pass those values here
x,current_level=sys.argv[1],sys.argv[2]
but when I try to pass the value in this way I get error list index out of range is there any better way to tackle with this problem please suggest it would be very helpful