Skip to main content

Code reuse between files in the same directory


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.




Comments