I have got a code made of several .m files, and I would like to turn it into a package. I have a few beginner questions
Can I force the loading order of the files by adding all of them in the
init.m
file?How can I access global variables from the package? For example, I could like to define a couple of variables that are settings used by the package. I usually do it in my main notebook, before loading the .m files with all functions. But as far as I understand, if I define it in the notebook variables will be in namespace global, and using the same variable in the package will instead search for the local variable. If I prepend
Global`
to the variable in the package, will it be able to find it?I have a very long settings file where I store most settings that I change very rarely. Now, these are one of the few things that actually needs to get shared in between all of the package fragments. As far as I understood one needs to write
PackageScope[variable]
for each variable one wants to share. Is there any way to automatise this for all variables in the file?