Timeline for How do I unload (reload) a Python module?
Current License: CC BY-SA 4.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 27, 2020 at 20:41 | history | edited | HoldOffHunger | CC BY-SA 4.0 |
Fixed "the the".
|
| May 5, 2020 at 15:46 | comment | added | EZLearner | I wrote a function below that does overrides the previous module's contents with the new one's and hence deals with the problem @bobince rightfully mentioned. See stackoverflow.com/a/61617169/2642356 | |
| Apr 27, 2016 at 0:57 | comment | added | Eliethesaiyan | @bobince,i think you are right for reload.. i previously used it from package imp | |
| Apr 22, 2016 at 14:07 | comment | added | bobince |
@Eliethesaiyan: do you mean the reload function? It is built-in, you don't have to import any library.
|
|
| Apr 20, 2016 at 13:18 | comment | added | Eliethesaiyan | it would be nicer for newbies if someone could reference where or from which library the function came from,in the case of this answer 'reload(module)' | |
| S Jul 14, 2015 at 6:15 | history | suggested | jdloft | CC BY-SA 3.0 |
Add backticks
|
| Jul 14, 2015 at 5:21 | review | Suggested edits | |||
| S Jul 14, 2015 at 6:15 | |||||
| Mar 26, 2013 at 15:13 | comment | added | bobince |
@shclamar: See stackoverflow.com/questions/1958417/… (and the links from there) for background. It's unclear to me (even looking at the import.c code) how the None entries managed to make their way back through the import mechanism when the 'real' entries were deleted, and I can't seem to make it happen on 2.7; in future certainly it's no longer a problem as implicit relative imports have gone away. In the meantime, deleting all entries with None value does seem to fix it.
|
|
| Mar 26, 2013 at 10:15 | comment | added | schlamar |
Can you elaborate the part with None values because I'm running exactly into this issue: I'm deleting items from sys.modules and after re-import some imported dependencies are None.
|
|
| Jun 2, 2012 at 10:29 | comment | added | bobince | @Josh: nope, it's for reloading a package tree, and even then it only works as long as the package doesn't have outside/circular dependencies. | |
| May 31, 2012 at 21:10 | comment | added | Josh | Isn't dreload specifically for that scenario? | |
| Jan 13, 2009 at 12:53 | history | answered | bobince | CC BY-SA 2.5 |