≈ the.bay.news

Modify 'import' command

Discussions on Python.org
Modify 'import' command
Does anyone know if it is possible to intercept the import statement somehow so that the source code could be automatically modified before it is saved as a compiled .pyc file? I think some might call this monkey-patching. I do have an example of how to do this manually using a source_to_code PatchedLoader but no idea how to apply that to all imports automatically.

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.