On May 12, 1:48 pm, Irmen de Jong <[EMAIL PROTECTED]> wrote: > Gruik wrote: > > But before that 1 question: what if I'm in Python ? > > Following your solution, I did that in Python : > > > def load_buffer(buffer) : > > compiled_buffer = compile(buffer, "module_name", "exec") > > exec(compiled_buffer) > > > It works great except that I can't have a module object and that it is > > as if I did "from module import *" > > But I need the module object and not an "import *" behavior. > > Any idea about the way to do that? > > Something along the lines of: > > import new > mymodule = new.module("mymodule") > exec <<<code>>> in mymodule.__dict__ > > --irmen
Yeah it works ! exec(compiled_module, globals(), mymodule.__dict__) Just to add mymodule to sys.modules and it's good! Thanks again Benjamin -- http://mail.python.org/mailman/listinfo/python-list