title: How to source script via python
body: <p>I can source bash script (without shebang) easy as bash command in terminal but trying to do the same via python command</p>
  
  <pre><code>sourcevars = "cd /etc/openvpn/easy-rsa &amp;&amp; . ./vars"
  runSourcevars = subprocess.Popen(sourcevars, shell = True)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>sourcevars = [". /etc/openvpn/easy-rsa/vars"]
  runSourcevars = subprocess.Popen(sourcevars, shell = True)
  </code></pre>
  
  <p>I receive :</p>
  
  <blockquote>
    <p>Please source the vars script first (i.e. "source ./vars")
    Make sure you have edited it to reflect your configuration.</p>
  </blockquote>
  
  <p>What's the matter, how to do it correctly?I've read some topics here,e.g <a href="https://stackoverflow.com/q/7040592/407651">here</a> but could not solve my problem using given advices. Please explain with examples.</p>
  
  <p>UPDATED:</p>
  
  <pre><code># os.chdir = ('/etc/openvpn/easy-rsa')
  initvars = "cd /etc/openvpn/easy-rsa &amp;&amp; . ./vars &amp;&amp; ./easy-rsa ..."
  
  
  # initvars = "cd /etc/openvpn/easy-rsa &amp;&amp; . ./vars"
  # initvars = [". /etc/openvpn/easy-rsa/vars"]
  cleanall = ["/etc/openvpn/easy-rsa/clean-all"]
  # buildca  = ["printf '\n\n\n\n\n\n\n\n\n' | /etc/openvpn/easy-rsa/build-ca"]
  # buildkey = ["printf '\n\n\n\n\n\n\n\n\n\nyes\n ' | /etc/openvpn/easy-rsa/build-key AAAAAA"]
  # buildca  = "cd /etc/openvpn/easy-rsa &amp;&amp; printf '\n\n\n\n\n\n\n\n\n' | ./build-ca"
  runInitvars = subprocess.Popen(cmd, shell = True)
  # runInitvars = subprocess.Popen(initvars,stdout=subprocess.PIPE, shell = True, executable="/bin/bash")
  runCleanall = subprocess.Popen(cleanall , shell=True)
  
  # runBuildca = subprocess.Popen(buildca , shell=True)
  # runBuildca.communicate()
  # runBuildKey = subprocess.Popen(buildkey, shell=True )
  </code></pre>
  
  <p>UPDATE 2</p>
  
  <pre><code>buildca  = ["printf '\n\n\n\n\n\n\n\n\n' | /etc/openvpn/easy-rsa/build-ca"]
  runcommands = subprocess.Popen(initvars+cleanall+buildca, shell = True)
  </code></pre>