At the moment, I am producing various complicated interactive plots. They all share a common "code base", with modifications on top of it.
I would like to refactor my code so that the various files call the common "code base". However, the code must be portable - only relative to the current directory.
What is the simplest way to achieve this? Packages seem complicated, and .nb files are preferable to .m files in my current setup. Therefore I have looked into a setup with library.nb
followed by Import["library.nb"]
in the other files. I couldn't get this to work for some reason, and would appreciate some guidance.
Get
with relative pathnames? The code has to be portable. $\endgroup$NotebookDirectory
,ParentDirectory
etc. should help. Sounds also like you should consider writing a package. $\endgroup$$Path
? $\endgroup$