I have a package file MyPackage.wl it has the following commands:
BeginPackage["Me`MyPackage`",{"ExternalContext1`","ExternalContext2`"}] ... Needs["Me`MyPackage`Internal`"]; ... EndPackage[]; Now within Internal.wl it has the following commands:
BeginPackage["Me`MyPackage`Internal`",{"Me`MyPackage`"}]; ... EndPackage[]; Now I can access the "Me`MyPackage`Internal`", "ExternalContext1`" and "ExternalContext2`" symbols inside MyPackage.wl but within Internal.wl I can only access "Me`MyPackage`" symbols but not "ExternalContext1`" and "ExternalContext2`".
So why are the contexts "ExternalContext1`" and "ExternalContext2`" not being added to the $ContextPath inside Internal.wl. I can always start Internal.wl by:
BeginPackage["Me`MyPackage`Internal`",{"ExternalContext1`","ExternalContext2`","Me`MyPackage`"}]; and it would work but as I add more and more ExternalContexts and there are more and more subcontexts, I don't want to keep updating this list inside every single subpackage. What is the better way of doing this?