avoid import short-circuiting

A

Andrea Crotti

I started the following small project:

https://github.com/AndreaCrotti/import-tree

because I would like to find out what exactly depends on what at
run-time, using an import hook.

It works quite well for small examples but the main problem is that once
a module is imported
it's added to sys.modules and then it doesn't go through the import hook
anymore.

I tried to mess around with sys.modules but it might not be a good idea,
and it leads to easy
infinite loops.
Is there a good way to achieve this?
I guess I could do the loop detection myself, but that should not be too
hard..

Thanks,
Andrea
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top