In debugging some module issues, I would like to have insight into what exactly happens when I run import google (or any import modules).
- Was it loaded or did it come from cache?
- Where did it get imported from? (its not always from a file - it is possible to create a module and add it into the namespace directly)
- What loader was used?
- What about anything that was imported during the import?
Is there a way to get diagnostics on this?
import googlelogs nothing because it is a builtin but it is not insys.builtin_module_namesso where is it coming from? It wasn't in the namespace previously soimportdid do something. More to the point, importing a module that I think should be on mysys.pathis not finding it, so I want to know what it triedsitemodule which is automatically loaded. Omitting it with-Sdoesn't preload that stuff