title: Open Python IDLE and Run Command
body: <p>I am working with an engineering software that allows me to run python scripts internally. However, it doesn't provide me with an IDLE which I need.</p>
  
  <p>I know I can store my required variables using Pickle and then load them latter. So basically I can write a script to load all variables, lets call this <strong>VarLoader.py</strong> . I also now that I can use the below to open a python idle:</p>
  
  <pre><code>import idlelib.PyShell
  idlelib.PyShell.main()
  </code></pre>
  
  <p><strong>But</strong> I don't know how to make it automatically run VarLoader.py in the opened IDLE. I mean something like the below would be ideal:</p>
  
  <pre><code>import idlelib.PyShell
  idlelib.PyShell.main(VarLoader.py)
  </code></pre>
  
  <p>I also tried the below which didn't work:</p>
  
  <pre><code>import sys
  sys.argv=['-c','VarLoader.py']
  </code></pre>
  
  <p>Any help and thoughts is appreciated.</p>
  
  <p>P.S. I also know that I can do the below but I want something more professional:</p>
  
  <pre><code>import os
  os.system(' '.join(['python','idle.py','-c','execfile('VarLoader.py')']))
  </code></pre>