0

I'm importing a module in ipython-notebook. It's taking 10 seconds. If in the same session, I'm importing that same module again it's taking 0.000004 secs. How to disable this inbuild caching of importing of modules ?

Thomas K
  • 39,200
  • 7
  • 84
  • 86
Sid
  • 76
  • 2
  • 8
  • 1
    Instead of disabling the cache, how about using [reload](https://docs.python.org/2/library/functions.html#reload) or in Python3, [importlib.reload](http://stackoverflow.com/q/27387786/190597)? – unutbu Jun 08 '16 at 10:13
  • No, that's exactly what I don't want. Example :- from a import b (takes 10 seconds) reload(b) (takes just 0.00004 seconds) I want the reloading to take the same time as before. – Sid Jun 09 '16 at 09:31
  • It's probably nothing to do with IPython. The first time you import a module, Python executes it and stores a module object. Every time after that, you just get a reference to the module object. This is how Python imports work, and if you do find a way to change it, you'll probably break all kinds of things. What are you trying to do with it? – Thomas K Jun 13 '16 at 10:43

0 Answers0