title: How to monitor a directory for changes in Python?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/597903/monitoring-files-directories-with-python">Monitoring files/directories with python</a>  </p>
  </blockquote>
  
  
  
  <p>I am making an API server that allows hot-deploying of code. And yes, there are dozens of questions about re-importing modules. I just want to monitor a directory, and when a change is detected, perform an action.</p>
  
  <pre><code>path_to_monitor="c:\\app\\package"
  def action():
      do_something()
  dm=dir_monitor(path_to_monitor,action)
  dm.start()
  </code></pre>
  
  <p>I need a solution that is mature and cross-platform.</p>