<pa***************@gmail.comescribió:
What's the current way to install an import hook? I've got an embeddedFrom that description alone I can't say what's happening; you should post
app
that has a few scripts that I want to import each other, but that are
not in
sys.modules. I intentionally keep them out of sys.modules because their
names will not be unique across the app. They will, however, be unique
between scripts that I (do* want to see each other).
Basically, I want to return a certain module from a name-based filter.
I've
already written a type in C with find_module and load_module, but it
doesn't
seem to work when I add the type to sys.path_hooks. I wrote a simple one
that worked just fine from a pure script file run through python.exe.
some code.
Also, if your importer isn't disk-based, perhaps using sys.meta_path is
better.
--
Gabriel Genellina