# Internal / external libraries

**URL:** <https://forum.fuel.network/t/internal-external-libraries/2399>\
**Category:** Sway\
**Created:** [April 18, 2023, 2:29pm UTC](https://forum.fuel.network/t/internal-external-libraries/2399 "2023-04-18T14:29:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![maurice](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@maurice](https://forum.fuel.network/u/maurice)\
**Post date:** [April 18, 2023, 2:29pm UTC](https://forum.fuel.network/t/internal-external-libraries/2399/1 "2023-04-18T14:29:51Z")

</div>

Hi people, feels like an easy question but this is driving me crazy.

Given some contract structure with an external library folder including a lib.sw entry point that mods all the other libraries of the library folder. How do I use library\_a inside library\_b?

This was incredibly easy before the previous library changes.  
So what I tried and didn’t work (inside library\_b):

```plaintext
mod library_a; // can't find file

use library_a::*; // mod library_b::library_a could not be found

use ::library_a::*; // module library_a could not be found

```

Thanks for any help 🙂

---

<div class="post-metadata">

**Author:** ![maurice](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@maurice](https://forum.fuel.network/u/maurice)\
**Post date:** [April 18, 2023, 2:49pm UTC](https://forum.fuel.network/t/internal-external-libraries/2399/2 "2023-04-18T14:49:40Z")

</div>

Okay, found the reason (thanks Armand) and I can hardly believe that this can be intended:

```plaintext
use ::library_a::*;

```

… works BUT ONLY if library\_b is declared BEFORE library\_a inside the lib.sw mod file. In a bigger project, “strategically” ordering all the libraries in the mod file would be really annoying.

---

<div class="post-metadata">

**Author:** ![furnic](https://avatars.discourse-cdn.com/v4/letter/f/97f17d/32.png) [@furnic](https://forum.fuel.network/u/furnic)\
**Post date:** [April 20, 2023, 1:02pm UTC](https://forum.fuel.network/t/internal-external-libraries/2399/3 "2023-04-20T13:02:12Z")

</div>

Glad to hear you got this working!  
This is indeed a known issue. Fortunately there is work underway in the compiler that will enable fixing this once and for all.  
In the Sway stdlib, we have to deal with this in our non-trivial `lib.sw` file and it is most definitely annoying. 🙂

---

<div class="post-metadata">

**Author:** ![maurice](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@maurice](https://forum.fuel.network/u/maurice)\
**Post date:** [April 20, 2023, 1:42pm UTC](https://forum.fuel.network/t/internal-external-libraries/2399/4 "2023-04-20T13:42:19Z")

</div>

Thank you Nick, much appreciated!
