Okay, several things going on here. First, from the documentation for Needs
(emphasis added)
Needs["context`"->"alias`"] adds "alias`"->"context`" to $ContextAliases, providing the ability to use a shorter or easier to type alias to access symbols in that context.
Contexts loaded with this form are not added to $ContextPath.
Unless you have some specific need that you haven't explained yet, you will want to have the $ContextPath
updated so that your new package context will get searched. This is how you will avoid prefixing all of your new symbols with the full context. So, just do this:
Needs["ContextA`" , FileNameJoin[{NotebookDirectory[], "ContextA.wl"}]]
Now, we need to get your new symbols into the ContextA
` context. The way to do that is to expose them after BeginPackage["ContextA
`"]
and before Begin["
`Private`"]
.
Read the documentation for BeginPackage
and Begin
. It explains how each affects the context and context path.
So, you could do something as simple as this:
extractSymbols::usage = "Extracts variables from models of a particular form, minus the t variable";
pSort::usage = "symbol precidence, with sub-sort on component ID";
M;w;A;t;
Now, get rid of all instances of "a`" (your alias), and your tests pass.