title: Scrapy - run at time interval
body: <p>i have a spider for crawling a site and i want to run it every 10 minutes. put it in python schedule and run it. after first run i got </p>
  
  <blockquote>
    <p>ReactorNotRestartable</p>
  </blockquote>
  
  <p>i try <a href="https://stackoverflow.com/a/43661172/7132357">this sulotion</a> and got</p>
  
  <blockquote>
    <p>AttributeError: Can't pickle local object 'run_spider..f'</p>
  </blockquote>
  
  <p>error.</p>
  
  <p>edit:
  try <a href="https://stackoverflow.com/questions/47552507/how-to-schedule-scrapy-crawl-execution-programmatically">how-to-schedule-scrapy-crawl-execution-programmatically</a> python program run without error and crawl function run every 30 seconds but spider doesn't run and i don't get data.</p>
  
  <pre><code>def run_spider():
  def f(q):
      try:
          runner = crawler.CrawlerRunner()
          deferred = runner.crawl(DivarSpider)
          #deferred.addBoth(lambda _: reactor.stop())
          #reactor.run()
          q.put(None)
      except Exception as e:
          q.put(e)
  
  runner = crawler.CrawlerRunner()
  deferred = runner.crawl(DivarSpider)
  
  q = Queue()
  p = Process(target=f, args=(q,))
  p.start()
  result = q.get()
  p.join()
  
  if result is not None:
      raise result
  </code></pre>