You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reload(x) command is essentially like quitting Manim altogether then starting it again with the -se option set to line x, but without the hassle of doing this manually and waiting for the complete window to be restarted. Instead, we reuse the window. Note that only your user-defined modules will be reloaded, no external libraries like numpy, no Python in-built modules like sys or time and also no manimlib files will be reloaded (the latter can be adjusted via a config option though).
The --autoreload command line flag will activate the autoreload IPython magic command. With this, your imported modules will be automatically reloaded for you such that you don't even have to execute reload() anymore.
The only missing piece (in my opinion), is a feature that enables auto-reloading also for classes/objects/etc. in the same file (and not only for imported files). E.g. consider this example
frommanimlibimport*classClassInSameFile:
defanswer(self):
return"Hello from class in same file"classAScene(Scene):
defconstruct(self):
## Startingprint("Hello from A")
## Class in same filetest=ClassInSameFile()
print(test.answer())
The autoreload feature from IPython will not pick up on changes to the string "Hello from class in same file" . If you do a reload(14) and then the checkpoint_paste(), it will work fine, but for the lazy programmer, that is one reload(14) too much 😅 A current workaround is to outsource ClassInSameFile to another file. Then import that into the original file and autoreload will do its magic.
Note that even if autoreload was perfect in the above sense, reload() might still have its raison d'être in the case where autoreloading might not work (due to whatever reason, I'm sure there might exist some...).
The text was updated successfully, but these errors were encountered:
In the last few weeks, 3b1b and me introduced these features to ease reloading:
reload()
command via Addreload()
command for interactive scene reloading #2240--autoreload
CLI flag via Autoreload v2 #2268The
reload(x)
command is essentially like quitting Manim altogether then starting it again with the-se
option set to linex
, but without the hassle of doing this manually and waiting for the complete window to be restarted. Instead, we reuse the window. Note that only your user-defined modules will be reloaded, no external libraries likenumpy
, no Python in-built modules likesys
ortime
and also nomanimlib
files will be reloaded (the latter can be adjusted via a config option though).The
--autoreload
command line flag will activate theautoreload
IPython magic command. With this, your imported modules will be automatically reloaded for you such that you don't even have to executereload()
anymore.The only missing piece (in my opinion), is a feature that enables auto-reloading also for classes/objects/etc. in the same file (and not only for imported files). E.g. consider this example
The autoreload feature from IPython will not pick up on changes to the string
"Hello from class in same file"
. If you do areload(14)
and then thecheckpoint_paste()
, it will work fine, but for the lazy programmer, that is onereload(14)
too much 😅 A current workaround is to outsourceClassInSameFile
to another file. Then import that into the original file and autoreload will do its magic.Note that even if autoreload was perfect in the above sense,
reload()
might still have its raison d'être in the case where autoreloading might not work (due to whatever reason, I'm sure there might exist some...).The text was updated successfully, but these errors were encountered: