Mathematica packages are isolated, in the sense that A`Sub` need not necessarily be a "sub-package" of A` , unless you explicitly make it so. Note that when you call BeginPackage["A`Sub`"], the context path is temporarily changed to just {"A`Sub`", "System`"}, meaning it has no idea about functions in A` . To fix this, you need to load A` in your sub-package as:
BeginPackage["A`Sub`"] Needs["A`"] ... EndPackage[] Now as you note, there is another way to load it and that is via BeginPackage["A`Sub`",{"A`"}]. These two ways of loading are not equivalent, as mentioned in this answerthis answer. Be sure to read that and use what best suits your needs.