Suppose I'm editing themod.py and testing it using %run thetest.py which contains import themod. I am not aware of any current mechanism to make %run thetest.py automatically reload themod when it has changed, but this would be an extremely useful feature.
That makes sense, although I'm not sure how easy it would be to implement. It probably won't be sorted before 0.11, though.
Though 2 years has gone, 0.13.1 still hasn't deep reload for %run yet.
I guess no-one has felt the need strongly enough to implement it. It should be possible with autoreload, if you'd like to have a go.
For what is worth, Spyder has had this functionality for a very long time. It deletes from the current namespace and then reloads all local modules used on a given script before re-running it.
@ccordoba12 where is the source code of the functionality in Spyder, Thanks.
@Honghe, you can find it here. runfile is our version of %run, and UserModuleDeleter is the class in charge of reloading local modules.
For the future we are considering to replace %run with runfile for kernels managed by us.
This would be extremely useful for me, means i only need one interpreter for everything! Would be great if it was just an option to the run command e.g. run -dr file.py
run -dr file.py
+1 for this feature request
If I know what is the problem hindering development of this I will gladly work on it, currently with '%autoreload 2' I get TypeError('super(type, obj): obj must be an instance or subtype of type)' any time I change a class that has a call to super. The solution could be a new %run2 comamnd that has a combination of [this answer](http://stackoverflow.com/a/2918951/311567] and Spyder's.
Here is another reload mechanism that takes care of old instances too: http://luke-campagnola.blogspot.com/2010/12/easy-automated-reloading-in-python.html
TypeError('super(type, obj): obj must be an instance or subtype of type)'