title: Get/Set serial class properties
body: <p>I'm using PySerial to connect to a Threaded connection. This is my simplified 1st class inheriting Thread and running serial:</p>
  
  <pre><code>from threading import Thread
  import serial, inspect
  
  class Serial1(Thread):
  
  def __init__(self,main_queue,port = "COM1")
  
      self.ser = serial.Serial()
      self.queue = main_queue
      self.port = port
  
  def open(self):
  
      self.ser.port = self.port
      if self.ser.isOpen():
          self.ser.close()
      self.ser.open()
      Thread.__init__(self)
      self.start()
  </code></pre>
  
  <p>After that I made another similar class Serial2 that inherits Thread and uses Serial1:</p>
  
  <pre><code>from Queue import Queue
  from threading import Thread
  import serial1
  
  class Serial2(Thread):
  
  def __init__(self,main_queue,port = "COM2")
  
      self.ser = serial1.Serial1()
      self.queue = main_queue
      self.port = port
  
  def open(self):
      self.ser = serial1.Serial1(self.queue, self.port)
      if self.ser.open() == True:
          Thread.__init__(self)
          if self.isAlive() == False:
              self.start()
  </code></pre>
  
  <p>Having done all that, how do I set/get the serial's port property on both Serial1 and Serial2? Suppose I'm using Serial1 and Serial2 in a script:</p>
  
  <pre><code>from Queue import Queue
  import serial2
  import serial1
  
  q1 = Queue(maxsize = 1)
  q2 = Queue(maxsize = 1)
  
  s1 = serial1.Serial1(q1, "COM4" )
  s2 = serial2.Serial2(q2, "COM2" )
  
  #get port value from Serial1 and Serial2
  port1 = s1.port
  port2 = s2.port
  
  #set Serial1 and Serial2 port value
  s1.port = "COM3"
  s2.port = "COM1"
  </code></pre>
  
  <p>I've tried using getter/setters in Serial1 before, but they resulted in an infinite recursion:</p>
  
  <pre><code>def getport(self): 
      return self.port
  
  def setport(self, port): #when first initialising self.port, it goes and get stuck here
      self.port = port
  
  port = property(getport,setport)
  </code></pre>