title: How to use Abstract Base Classes in Python?
body: <p>Following <a href="http://pymotw.com/2/abc/" rel="nofollow">this tutorial</a> I'm trying to use Abstract Base Classes in Python. So I constructed two files:</p>
  
  <p><strong>basis.py</strong>:</p>
  
  <pre><code>import abc
  
  class PluginBase(object):
      __metaclass__ = abc.ABCMeta
  
      @abc.abstractmethod
      def load(self, input):
          return
  </code></pre>
  
  <p>and <strong>implementation.py</strong>:</p>
  
  <pre><code>import abc
  from basis import PluginBase
  
  class SubclassImplementation(PluginBase):
  
      def load(self, input):
          print input
          return input
  
  if __name__ == '__main__':
      print 'Subclass:', issubclass(SubclassImplementation, PluginBase)
      print 'Instance:', isinstance(SubclassImplementation(), PluginBase)
  </code></pre>
  
  <p>running <code>python implementation.py</code> works fine, but I now want to use <code>implementation.py</code> as a module for something else. So I get into the command line and do:</p>
  
  <pre><code>&gt;&gt;&gt; from implementation import SubclassImplementation as imp
  &gt;&gt;&gt; imp.load('lala')
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  TypeError: unbound method load() must be called with SubclassImplementation instance as first argument (got str instance instead)
  &gt;&gt;&gt;
  </code></pre>
  
  <p>What am I doing wrong here, and how can I make this work? All tips are welcome!</p>