I currently have a python script that runs every few minutes and picks up "rules", in my case python classes, within files in a directory tree. for each class it can load it runs "execute()" and in this way lets me do useful things like monitor log files and so on.
I'm now revisiting the script to make it self documenting and it strikes me that perhaps there is a neater way of picking up these ad hoc classes; maybe a framework or nice example somewhere.
Can anyone suggest a neat solution?
You can simply import the modules (use the __import__ function), and reload them when they change.
Note that you will still have the issue that existing instances of classes will not automagically change to reflect the new class definition.
Can someone recommend a pythonic approach to loading adhoc code?