Altering imported modules

Tro troworld at gmail.com
Sun Mar 2 15:50:09 EST 2008


On Saturday 01 March 2008, Tro wrote:
> Hi, list.
>
> I've got a simple asyncore-based server. However, I've modified the
> asyncore module to allow me to watch functions as well as sockets. The
> modified asyncore module is in a specific location in my project and is
> imported as usual from my classes.
>
> Now I'd like to use the tlslite library, which includes an asyncore mixin
> class. However, tlslite imports "asyncore", which doesn't include my own
> modifications.
>
> I'd like to know if it's possible to make tlslite load *my* asyncore module
> without changing any of the tlslite code.

I guess I could just copy over the relevant tlslite file that imports asyncore 
and change the import, but that seems clumsy.

Is there no better way?

Thanks,
Tro



More information about the Python-list mailing list