I have a decorator named, say, @find_me. I want to find all classes that are decorated with it. 
Or, I have a class named, say, FindMe, and I want to find all subclasses of it.
Why? because I want to do something with those classes before they are being import-ed.
So I read about __subclasses()__ and about finding decorators.
The problem with the solutions I found is that the class has to be import-ed before the code runs.
In other words, if I have:
- in module ${proj_root}/some_path/FindMe.pyaclass FindMe(object):,
- and in module ${proj_root}/some_other_path/NeedsToBeFound.py, aclass NeedsToBeFound(FindMe):,
- and another module ${proj_root}/yet_another_path/some_module.py,
- and if some_module.pylooks something like:
import ... FindMe
...
subclasses_of_FindMe = FindMe.__subclasses()__
then the expected class NeedsToBeFound won't be in the result (assuming there was no import of it somewhere along the way).
So I guess I'm looking for a way to do some sort of a component scan over all python classes (that are located in the subtree of ${proj_root}).
How what would it be simpler to do: find decorators or find subclasses? And how can I do that?...
Thanks in advance!
 
     
    