title: Celery - AttributeError: 'NoneType' object has no attribute 'delay'
body: <p>I have couple of celery tasks. The  crawl_all_sites_tasks submits multiple crawl_each_batch tasks.</p>
  
  <p>The first tasks processes the first for loop - crawl_each_batch but once thats done I get this error - </p>
  
  <p>tasks.py</p>
  
  <pre><code> from utils import crawl_all_sites
      @app.task(name='webcrawler.crawl_all_sites')
      def crawl_all_sites_task():
          print 'crawling tasks'
          crawl_all_sites()
  
      from utils import crawl_each_batch
      @app.task(name='webcrawler.crawl_each_sites')
      def crawl_each_batch_task(filename):
          crawl_each_batch(filename)
  </code></pre>
  
  <p>utils.py</p>
  
  <pre><code>from p_webcrawler_lib.p_crawler import main
  
  files = ['splitfilesaa'
  ,'splitfilesab'
  ,'splitfilesac'
  ]
  def crawl_each_batch(filename):
      print 'utils_crawl_each_batch'
      main('./apps/webcrawler/batch_files/'+filename)
  
  
  def crawl_all_sites():
      print 'utils_crawl_all_sites'
      from tasks import crawl_each_batch_task
      for each in files:
          #crawl_each_batch(each).delay()
          crawl_each_batch_task(each).delay()
  </code></pre>
  
  <p>Error:-</p>
  
  <pre><code>[2015-11-18 03:36:52,013: ERROR/MainProcess] Task webcrawler.crawl_all_sites[31c84a68-0171-45ee-93ce-ab3a879dd8a7] raised unexpected: AttributeError("'NoneType' object has no attribute 'delay'",)
  Traceback (most recent call last):
    File "/Users/prem/state-dept/refactor/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
      R = retval = fun(*args, **kwargs)
    File "/Users/prem/state-dept/refactor/lib/python2.7/site-packages/celery/app/trace.py", line 438, in __protected_call__
      return self.run(*args, **kwargs)
    File "/Users/prem/state-dept/analytics_refactor/apps/webcrawler/tasks.py", line 21, in crawl_all_sites_task
      crawl_all_sites()
    File "/Users/prem/state-dept/analytics_refactor/apps/webcrawler/utils.py", line 21, in crawl_all_sites
      crawl_each_batch_task(each).delay()
  AttributeError: 'NoneType' object has no attribute 'delay'
  </code></pre>