# Simplify BeginPackage with Package of Packages

I have a group of Packages that I use to create a lot of other Packages. Let's see an example:

BeginPackage["testPack",{"auxPack01","auxPack02","auxPack03","auxPack04"}]
testFunc::usage="testFunc[]"
Begin["Private"]
(*...package code...*)
End[]
EndPackage[]

My question is:

How can I create an auxPack (or some other simplification) so, I can just call it, instead of auxPack01, auxPack02 ... or a variable with all the definitions?

I tried to create a variable

$auxPacks={"auxPack01","auxPack02","auxPack03","auxPack04"} So I could call BeginPackage["testPack",$auxPacks]

But didn't work. I also tried to create my own BeginPackage function as:

myBeginPackage[packName_String]:=BeginPackage[packName,{"auxPack01","auxPack02","auxPack03","auxPack04"}]

But didn't work either.

Something similar this last try would be the best option to me. Any clue?

• Could you elaborate on "didn't work" part, because your both solutions work for me. Problem with them is that $auxPacks or myBeginPackage needs to live in some context, which needs to be on$ContextPath when loading package. – jkuczm Dec 29 '14 at 13:15
• You could create a "grouping package": BeginPackage["auxPack",{"auxPack01", ...}]; EndPackage[] and then call BeginPackage["testPack", "auxPack"] – jkuczm Dec 29 '14 at 13:18
• Have you used any of suggestions, if so, maybe post selfanswer? :) – Kuba Nov 17 '15 at 7:34
• @Kuba I will post – Murta Nov 17 '15 at 11:21
• – Szabolcs May 19 '16 at 11:07