##// END OF EJS Templates
_ip.load runs init_ipython even if the module already exists
vivainio -
Show More
@@ -183,6 +183,7 b' class IPApi:'
183 # The ipython instance provided
183 # The ipython instance provided
184 self.IP = ip
184 self.IP = ip
185
185
186 self.extensions = {}
186 global _recent
187 global _recent
187 _recent = self
188 _recent = self
188
189
@@ -380,12 +381,18 b' class IPApi:'
380 self.IP.rl_next_input = s
381 self.IP.rl_next_input = s
381
382
382 def load(self, mod):
383 def load(self, mod):
383 if mod in sys.modules:
384 if mod in self.extensions:
384 return
385 # just to make sure we don't init it twice
386 # note that if you 'load' a module that has already been
387 # imported, init_ipython gets run anyway
388
389 return self.extensions[mod]
385 __import__(mod)
390 __import__(mod)
386 m = sys.modules[mod]
391 m = sys.modules[mod]
387 if hasattr(m,'init_ipython'):
392 if hasattr(m,'init_ipython'):
388 m.init_ipython(self)
393 m.init_ipython(self)
394 self.extensions[mod] = m
395 return m
389
396
390
397
391 def launch_new_instance(user_ns = None):
398 def launch_new_instance(user_ns = None):
General Comments 0
You need to be logged in to leave comments. Login now