title: run python file from another file with dynamic path
body: <p>I try to run command in my python file, which located in dynamic file. I try to use the <code>import</code> statement, which as I understand is the better solution for this case.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>from subprocess import call
  import tarfile
  from contextlib import closing
  
  def tarfile1(path):
      with closing(tarfile.open(path)) as tar:
        tar.extractall(path)
      import path as runcommand
      runcommand.main()
  </code></pre>
  
  <p>The problem is that path is a string, and it gives me the following error:</p>
  
  <pre><code>    import path as runcommand
  ImportError: No module named path
  </code></pre>
  
  <p>How can I import the file, which I don't know its name, and run the main command from it?</p>