title: Python Reddis Queue ValueError: Functions from the __main__ module cannot be processed by workers
body: <p>I'm trying to enqueue a basic job in redis using python-rq, But it throws this error </p>
  
  <blockquote>
    <p>"ValueError: Functions from the <strong>main</strong> module cannot be processed by workers"</p>
  </blockquote>
  
  <h2>Here is my program:</h2>
  
  <pre><code>import requests
  
  def count_words_at_url(url):
      resp = requests.get(url)
      return len(resp.text.split())
  
  from rq import Connection, Queue
  from redis import Redis
  redis_conn = Redis()
  q = Queue(connection=redis_conn)
  job = q.enqueue(count_words_at_url, 'http://nvie.com')
  print job
  </code></pre>