Extending program with imported user code.

Ian Sparks ians at etrials.com
Thu Jan 16 12:04:19 EST 2003


I have a python (2.2) program that does PDF rendering (www.reportlab.com). It has a method something like :

def drawfooter(..):
    blah....

I'd like to be able to override this default behaviour by importing user-defined code. So I'd envison that my user would write a replacement drawfooter() function with the same signature in a text file, my code will look for that file and import it somehow to override the existing behaviour.

What would be the best way of going about this kind of dynamic function-replacement?






More information about the Python-list mailing list