title: Calling a method <name> I get AttributeError: 'int' object has no attribute <name>
body: <p>I have a callback method being triggered on a GPIO pin that when fired calls for a read of a input devices register, however when called I get -</p>
  
  <blockquote>
    <blockquote>
      <blockquote>
        <p>Traceback (most recent call last):
          File "/home/coder/Try2.py", line 35, in NewPins
            x = self.mcp.readGPIO()
        AttributeError: 'int' object has no attribute 'mcp'</p>
      </blockquote>
    </blockquote>
  </blockquote>
  
  <p>If I enter- 
      <code>a.mcp.readGPIO()</code>  &lt;- from python shell I get</p>
  
  <pre><code>`BitArray('0xffff')`  &lt;-expected result
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>where the RotaryEncoder class is instantiated as 'a'</p>
  
  <pre><code> `class RotaryEncoder:`
     `def __init__(self,IntPin, Start, Id):`
       .... initialise some variables then open the device as 'mcp' -
     `self.mcp = MCP23S17(bus=0x00, pin_cs=0x00, device_id=Id)`
     `self.mcp.open()`
     `def NewPins(self):`
     `   global OldPins`
     `   x = self.mcp.readGPIO()`
          ..... irrelevant code
  </code></pre>
  
  <p>callback line is 
      <code>gpio.add_event_detect(IntPin, gpio.FALLING, callback=NewPins)</code></p>
  
  <p>expected read value is a BitArray
  actual result is 
  AttributeError: 'int' object has no attribute 'mcp'</p>