Python __subclasses__() not listing subclasses
<p>I cant seem to list all derived classes using the <code>__subclasses__()</code> method. Here's my directory layout:</p>

<pre><code>import.py
backends
      __init__.py
    --digger
          __init__.py
          base.py
          test.py
        --plugins
              plugina_plugin.py
</code></pre>

<p>From <code>import.py</code> i'm calling <code>test.py</code>. <code>test.py</code> in turn iterates over all the files in the <code>plugins</code> directory and loads all of them. <code>test.py</code> looks like this:</p>

<pre><code>import os
import sys
import re

sys.path.append(os.path.join(os.path.abspath(os.path.dirname(os.path.abspath( __file__ )))))
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(os.path.abspath( __file__ ))), 'plugins'))

from base import BasePlugin

class TestImport:
    def __init__(self):
        print 'heeeeello'

        PLUGIN_DIRECTORY = os.path.join(os.path.abspath(os.path.dirname(os.path.abspath( __file__ ))), 'plugins')

        for filename in os.listdir (PLUGIN_DIRECTORY):
            # Ignore subfolders
            if os.path.isdir (os.path.join(PLUGIN_DIRECTORY, filename)):
                continue
            else:
                if re.match(r".*?_plugin\.py$", filename):
                    print ('Initialising plugin : ' + filename)
                    __import__(re.sub(r".py", r"", filename))

        print ('Plugin system initialized')
        print BasePlugin.__subclasses__()
</code></pre>

<p>The problem us that the <code>__subclasses__()</code> method doesn't show any derived classes. All plugins in the <code>plugins</code> directory derive from a base class in the <code>base.py</code> file.</p>

<p><code>base.py</code> looks like this:</p>

<pre><code>class BasePlugin(object):
    """
    Base
    """
    def __init__(self):
        pass
</code></pre>

<p><code>plugina_plugin.py</code> looks like this:</p>

<p>from base import BasePlugin</p>

<pre><code>class PluginA(BasePlugin):
    """
    Plugin A
    """
    def __init__(self):
        pass
</code></pre>

<p>Could anyone help me out with this? Whatm am i doing wrong? I've racked my brains over this but I cant seem to figure it out</p>

<p>Thanks.</p>
