title: error in python setting method for callbacks
body: <p>I try to define a Class in python for managing WebSockets, this <a href="https://pypi.python.org/pypi/websocket-client/" rel="nofollow noreferrer">docu-example</a> is what am using</p>
  
  <p>this is my code:</p>
  
  <pre><code>#!/usr/bin/env python
  # -*- coding: utf-8 -*-
  import json
  import websocket
  import thread
  import time
  
  class WebSocket:
      def on_message1(self, ws, message):
          print message
  
      def on_error1(self, ws, error):
          print error
  
      def on_close1(self, ws):
          print "Socket Closed"
  
      def start(self):
          global ws
          ws.run_forever()
  
      def __init__(self, host, port):
          self.host = host
          self.port = port
          websocket.enableTrace(True)
          self.ws = websocket.WebSocketApp("ws://" + host+":"+port,
                                          on_message = on_message1,
                                          on_error = on_error1,
                                          on_close = on_close1))
  
  if __name__ == '__main__':
      print "Error: create an instance of this class instead!"
  </code></pre>
  
  <p>But when I run the code I get the error:</p>
  
  <blockquote>
    <p>File "/home/pi/ABC/CASCADE/WebSocketClientClass.py", line 37, in <strong>init</strong></p>
    
    <p>NameError: global name 'on_message1' is not defined
    it is defined but somehow is not working... why?</p>
  </blockquote>
  
  <p>thanks</p>