I cant seem to list all derived classes using the __subclasses__() method. Here\'s my directory layout:
import.py
backends
__init__.py
There were no other base.py files. I'm on a WinXP (SP2) with Python 2.6. I added another class to my test.py file called PluginB which used BasePlugin as the base class. When i did
print PluginA.__mro__
print PluginB.__mro__
I got:
(<class 'plugina_plugin.PluginA'>, <class 'base.BasePlugin'>, <type 'object'>)
(<class 'backends.digger.test.PluginB'>, <class 'backends.digger.base.BasePlugin'>, <type 'object'>)
As you can see, they're both using the same base plugin but the qualified names are different. This was because in plugina_plugin.py I was importing BasePlugin like this:
from base import BasePlugin
Instead of:
from backends.digger.base import BasePlugin
Fixing this fixed it.
Perhaps the plugins are finding another base.py hiding somewhere (the plugin directory for example).
Run with python -v to see if two different base.py are getting imported
You can also look at PluginA.__mro__ and confirm that the BasePlugin in there is the right one