title: Initializing global object in Python
body: <p>In summary, my problem is how do you easily make a connection resource a global variable? To be specific, I'd like to open a Redis queue connection and would like to use that in multiple functions without the hassle of passing it as a parameter, i.e.'</p>
  
  <pre><code>#===============================================================================
  # Global variables
  #===============================================================================
  REDIS_QUEUE &lt;- how to initialize
  </code></pre>
  
  <p>Then, in my main function, have</p>
  
  <pre><code># Open redis queue connection to server
  REDIS_QUEUE = redis.StrictRedis(host=SERVER_IP, port=6379, db=0)
  </code></pre>
  
  <p>And then use <code>REDIS_QUEUE</code> in multiple functions, e.g. </p>
  
  <pre><code>def sendStatusMsgToServer(statusMsg):
      print "\nSending status message to server:"
      print simplejson.dumps(statusMsg)
      REDIS_QUEUE.rpush(TLA_DATA_CHANNEL, simplejson.dumps(statusMsg))
  </code></pre>
  
  <p>I thought <code>REDIS_QUEUE = none</code> would work but it gives me </p>
  
  <pre><code>AttributeError: 'NoneType' object has no attribute 'rpush'
  </code></pre>
  
  <p>I'm new to Python, what's the best way to solve this? </p>