Import without a .py file

Michael Ross mross at
Thu May 11 21:03:55 EDT 2000

I would like to accomplish the equivalent of an import, but store module
code in a database (rather than in .py files).

Is there any way to create a module using code that did not originate in
a file?  For example, I can get the text for the code into a string
object, and then I'd like to say

s = ...string containing code with classes and functions...
import module using s

obviously I can't do that, but something equivalent would be nice.

Mike Ross

More information about the Python-list mailing list