# Package organization in a Wolfram Language application

**URL:** <https://community.wolfram.com/t/package-organization-in-a-wolfram-language-application/14792>\
**Category:** Questions\
**Tags:** software-development, packages-and-paclets, ui-ux-and-ide\
**Created:** [October 1, 2019, 6:09pm UTC](https://community.wolfram.com/t/package-organization-in-a-wolfram-language-application/14792 "2019-10-01T18:09:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wandzura](https://avatars.discourse-cdn.com/v4/letter/w/8baadc/32.png) [@wandzura](https://community.wolfram.com/u/wandzura)\
**Post date:** [October 1, 2019, 6:09pm UTC](https://community.wolfram.com/t/package-organization-in-a-wolfram-language-application/14792/1 "2019-10-01T18:09:06Z")

</div>

I have watched the Video “Creating Documentation with Wolfram Workbench” several times, but there are some things I still don’t understand. In discussion of recommended package organization for large projects it suggests the main .m | .wl file look like:

`(* Wolfram Language Package *) BeginPackage["GoodStuff"] Get["GoodStuff`SubPackage1`"] Get["GoodStuff`SubPackage2`"] ... EndPackage\[\]`

The subfile SubPackage2.m (in the same folder as GoodStuff.m) should look like:

`(* Wolfram Language Package *) foo::usage="foo\[\] is a function that does nothing wrong because it does nothing." Unprotect[foo] Begin["Private``"] foo[___]:=Null End\[\] SetAttributes[foo,{Protected}]`

Here is the issue: suppose SubPackage1 wants to use the function foo defined in SubPackage2. If I The usage message in SubPackage2 will not be encountered before the invocation of foo in SP1, and will thus create a symbol `GoodStuff``Private``foo`. What is the proper way to handle such a situation? Should I create a file AllUsageMessages.m and read it in before SP1 and SP2? It might be suggested that one should not use symbols before their containing file is read, but I think sometimes you need subsets that contain functions defined in each other. [Please forgive the " ’ `" - I am new to this system…]

---

<div class="post-metadata">

**Author:** ![jasonb](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/jasonb/32/20741_2.png) [@jasonb](https://community.wolfram.com/u/jasonb)\
**Post date:** [October 1, 2019, 7:56pm UTC](https://community.wolfram.com/t/package-organization-in-a-wolfram-language-application/14792/2 "2019-10-01T19:56:40Z")

</div>

One way to tackle this is to put all usage messages in the main package file, and then spread the implementation out in different subpackages. So just change what you have to

```
(* Wolfram Language Package *)
BeginPackage["GoodStuff`"]
    foo::usage = "foo[] is a function that does nothing wrong because it does nothing."
    bar::usage = "bar[] is another function"
    ....

    Get["GoodStuffSubPackage1"](* implements bar, can reference foo *)
    Get["GoodStuffSubPackage2"](* implements foo *)
          ...
EndPackage[]

```

---

<div class="post-metadata">

**Author:** ![wandzura](https://avatars.discourse-cdn.com/v4/letter/w/8baadc/32.png) [@wandzura](https://community.wolfram.com/u/wandzura)\
**Post date:** [October 1, 2019, 9:54pm UTC](https://community.wolfram.com/t/package-organization-in-a-wolfram-language-application/14792/3 "2019-10-01T21:54:51Z")

</div>

Yes, thank you - I understand.  
This is nearly the same as my idea to `Get["GoodStuff``AllUsageMessages`"]`
