title: passing variable value from django to another python script
body: <p>I want to run an external python file</p>
  <p>the Django.view code is as follows:</p>
  <pre><code>
  def generate(request):
      a=int(request.POST[&quot;status&quot;])
      b=int(request.POST[&quot;level&quot;])
      run(['python', 'water.py',a,b])
  </code></pre>
  <p>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</p>
  <pre><code>from time import time
  import sys
  from __main__ import*
  
  
  
  
  # trying to pass those values here 
  x,current_level=sys.argv[1],sys.argv[2]
  
  </code></pre>
  <p>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</p>