title: How to stop a Python script executing immediately
body: <p>I have a python script (script.py) with a bunch of functions, and then a main() function that runs everything.</p>
  
  <p>After the main(), I also have:</p>
  
  <pre><code>if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>I am now writing a separate script (timer.py) to run script.py every day at midnight.</p>
  
  <pre><code>import schedule
  import time
  from script import main
  
  schedule.every().day.at("00:00").do(main(),'It is 00:00')
  
  while True:
      schedule.run_pending()
      time.sleep(60) # wait one minute
  </code></pre>
  
  <p>But when I run it, the main seems to run immediately. I thought that the <code>if</code> condition above would prevent that from happening?</p>
  
  <p>Thanks.</p>