title: Running a Python script in a Makefile
body: <p>I have a Python script (scr1.py) that calls another Python script (scr2.py) and they both on the same path. When I open CMD and run scr1.py everything works perfectly.</p>
  
  <p>I want to run scr1.py inside a Makefile that is NOT on the same path as the scripts. The scr1.py is executing but fail on calling scr2.py. I think the problem is that scr1.py searches the Makefile directory instead of the scripts directory.
  How can I fix it?</p>
  
  <p>The code:</p>
  
  <pre><code>import os
  import scr2
  fileinfo = os.stat('scr2.py')
  
  if os.path.isfile("infofile.txt"):          
      file=open("infofile.txt",'r')       
      lm = file.read()
      file.close()
      if lm == str(fileinfo.st_mtime): 
          #Do_Something
      else:
          scr2
  else:
      scr2
      file = open("infofile.txt",'w')
  </code></pre>
  
  <p>OK, I just fount another problem.
  When you import another file, it runs this file IN THE IMPORT LINE!
  It means that this isn't the right way to import a file, unless you use the import line where you want to run the script, but it is so ugly.</p>