Best way to pickle functions

Aaron Scott aaron.hildebrandt at gmail.com
Fri Apr 3 16:48:17 EDT 2009


> Why not use import ?  Simply recreate the source file, if necessary, and
> import it again.
>

Ah, you'd think it would be that easy :P

The problem with just importing a module is that the module is then
cached in memory. Multiple copies of the program are running on a
server, and each of them have something akin to a "randomfunctions"
module. When the first program is accessed, it loads
"randomfunctions". When the second program is accessed, it uses the
"randomfunctions" module already in memory, even though it doesn't
contain the right functions. So, I have to pull in these functions
dynamically.



More information about the Python-list mailing list