# How to use a nested folder's module in Verse?

**URL:** <https://forums.unrealengine.com/t/how-to-use-a-nested-folders-module-in-verse/1172220>\
**Category:** Verse\
**Tags:** fortnite-creative, unreal-editor-for-fortnite, question, fortnite\
**Created:** [May 20, 2023, 8:15am UTC](https://forums.unrealengine.com/t/how-to-use-a-nested-folders-module-in-verse/1172220 "2023-05-20T08:15:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![t.tutiya](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/t.tutiya/32/924637_2.png) [@t.tutiya](https://forums.unrealengine.com/u/t.tutiya)\
**Post date:** [May 20, 2023, 8:15am UTC](https://forums.unrealengine.com/t/how-to-use-a-nested-folders-module-in-verse/1172220/1 "2023-05-20T08:15:21Z")

</div>

Hi. How to access a nested folder’s module in Verse?

For example, if I want to access a module in Sub3.verse placed in the Sub1/Sub2 folder, how should I write the using clause?

Unfortunately, the code below did not work.

```auto
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

using { Sub1}
using { Sub2} #Invalid access of internal module `(/localhost/MyProject230520/Sub1:)Sub2` 
using { Sub1.Sub2} #Invalid access of internal module `(/localhost/MyProject230520/Sub1:)Sub2` 
using { Sub3} #Unknown identifier `Sub3`.(3506)
using { Sub1.Sub2.Sub3} #Unknown member `Sub3` in `Sub2`.(3506)
using { Sub1.Sub3} #Unknown member `Sub3` in `Sub1`.(3506)

testDevice1 := class(creative_device):
    OnBegin<override>()<suspends>:void=
        Print("test")

```

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/6/d/36d712f9f8492b3b4c740e07a23d8978796d01b8.png)

---

<div class="post-metadata">

**Author:** ![Mapshot\_Agency](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mapshot_agency/32/700660_2.png) [@Mapshot\_Agency](https://forums.unrealengine.com/u/Mapshot_Agency)\
**Post date:** [May 22, 2023, 7:26am UTC](https://forums.unrealengine.com/t/how-to-use-a-nested-folders-module-in-verse/1172220/2 "2023-05-22T07:26:36Z")

</div>

That’s something I would like to know as well! Haven’t played around with it yet though.

---

<div class="post-metadata">

**Author:** ![AJ\_Lakeman](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/aj_lakeman/32/770700_2.png) [@AJ\_Lakeman](https://forums.unrealengine.com/u/AJ_Lakeman)\
**Post date:** [May 31, 2023, 7:23pm UTC](https://forums.unrealengine.com/t/how-to-use-a-nested-folders-module-in-verse/1172220/3 "2023-05-31T19:23:10Z")

</div>

Hey, did you manage to resolve this in the end? I’ve seen it working for others but I get the ‘Invalid access of internal module’ no matter what I seem to try.

---

<div class="post-metadata">

**Author:** ![ArmoredJP](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/armoredjp/32/712903_2.png) [@ArmoredJP](https://forums.unrealengine.com/u/ArmoredJP)\
**Post date:** [June 6, 2023, 3:46pm UTC](https://forums.unrealengine.com/t/how-to-use-a-nested-folders-module-in-verse/1172220/4 "2023-06-06T15:46:42Z")

</div>

When you create a subfolder in a verse project, the verse compiler creates a `module` with an implicit `<internal>` access specifier. Because of the _implicit_ `internal` you cannot access the submodule from outside the outer module.

The directory structure `Sub1/Sub2/Sub3/SomeClass.verse` is equivalent to

```auto
Sub1 := module:
    Sub2 := module:
        Sub3 := module:
            # Contents of SomeClass.verse
            some_class := class:
                SomeInt : int = 0

```

You can, however, explicitly declare the `Sub2` module with `<public>` access specifier like this:

```auto
# Sub1/Sub2.verse
Sub2<public> := module{}

```

You could then access the `Sub2` module like this:

```auto
# Use Sub1 *and* Sub2 contents
using { Sub1 }
using { Sub2 }

# Use Sub2 *without* using Sub1
using { Sub1.Sub2 }

```

---

<div class="post-metadata">

**Author:** ![Xexu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Xexu](https://forums.unrealengine.com/u/Xexu)\
**Post date:** [August 27, 2023, 1:14pm UTC](https://forums.unrealengine.com/t/how-to-use-a-nested-folders-module-in-verse/1172220/5 "2023-08-27T13:14:45Z")

</div>

So, it is not possible to have a structure of folders like Sub1 → Sub2 → Sub3.verse  
and use Sub3.verse from outside Sub1, because Sub2 is internal?  
As I understand your solution is to declare a Sub2.verse , but then you will not have a Sub2 folder and instead you will have a file for that module

---

<div class="post-metadata">

**Author:** ![Nooberling](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nooberling/32/722605_2.png) [@Nooberling](https://forums.unrealengine.com/u/Nooberling)\
**Post date:** [September 13, 2023, 12:44pm UTC](https://forums.unrealengine.com/t/how-to-use-a-nested-folders-module-in-verse/1172220/6 "2023-09-13T12:44:42Z")

</div>

> [@ArmoredJP](#):
>
> `Sub2<public> := module{}`

I can’t get this to work. When I create a file modeled entirely on your first example, it still throws an error in both VSCode and the UEFN editor. I want to define a device then use it as an editable, but apparently this is illegal. I understand the desire to clean up code by binding submodules to the filesystem locations, but not having clean class definitions to work with is - in my humble but currently furstrated opinion - not ideal.

Edit: Figured this out. Made my device definition public. My irritability about module access structure being invisibly bound to directory structure stands.

---

<div class="post-metadata">

**Author:** ![Kamyker](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kamyker/32/1194621_2.png) [@Kamyker](https://forums.unrealengine.com/u/Kamyker)\
**Post date:** [October 28, 2023, 12:05am UTC](https://forums.unrealengine.com/t/how-to-use-a-nested-folders-module-in-verse/1172220/7 "2023-10-28T00:05:23Z")

</div>

This seems very inconvenient. If I copy a nested folder to another project I have to create another file (or copy) that exposes the module.

This brings the question why modules aren’t public by default? In other languages (C#, C++) namespaces are public and don’t have access specifiers at all.

---

<div class="post-metadata">

**Author:** ![t.tutiya](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/t.tutiya/32/924637_2.png) [@t.tutiya](https://forums.unrealengine.com/u/t.tutiya)\
**Post date:** [October 28, 2023, 2:46am UTC](https://forums.unrealengine.com/t/how-to-use-a-nested-folders-module-in-verse/1172220/8 "2023-10-28T02:46:42Z")

</div>

For more infomation about a module.

> [@How to create and use a module in Verse?](https://forums.unrealengine.com/t/how-to-create-and-use-a-module-in-verse/1154823/):
>
> Hi, I’d love to use modules to structure and logically group my scripts/classes. But I can’t seem to understand how to reference modules. According to the docs, I can create a module by: Creating a folder. Creating a module inside a script by using module() instead of class(). The problem comes when I want to use a module from scripts outside the module. I can’t seem to understand how to use the using { / } to reference custom modules. The autocomplete tells me that the path is /Localhost/.…

> [@Verse - Folders with a dot in the name(Project failed to update)](https://forums.unrealengine.com/t/verse-folders-with-a-dot-in-the-name-project-failed-to-update/1170819):
>
> I set the name including the dot to module subfolder(like “[submodule.com](http://submodule.com)”). I was able to build this. However, when I connect to the server, the game does not start. OutputLog below. LogValkyrieSummary: Project MyProject failed to update Popup when folder name is changed [0519\_1] Popup when connecting to the server [0519\_2] thank you

> [@Ask Epic Anything: Programming & Scripting | May 24th, 2023 at 12:30PM EST](https://forums.unrealengine.com/t/ask-epic-anything-programming-scripting-may-24th-2023-at-12-30pm-est/1168968/97):
>
> Currently everything is known by UEFN - all the API is specified in the three \*.digest.verse files. In the future it would download from an online code / asset repository. It is the difference between local vs. remote modules. Yup. Eventually.

---

<div class="post-metadata">

**Author:** ![WSkibidiRizz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WSkibidiRizz](https://forums.unrealengine.com/u/WSkibidiRizz)\
**Post date:** [January 31, 2024, 1:48am UTC](https://forums.unrealengine.com/t/how-to-use-a-nested-folders-module-in-verse/1172220/9 "2024-01-31T01:48:23Z")

</div>

> [@ArmoredJP](#):
>
> the verse compiler creates a `module` with an implicit `<internal>` access specifier

This is _ **really** _ inconvenient for organizing a good file structure within my map, for seemingly no reason… Is there any plans to change this in the future?

---

<div class="post-metadata">

**Author:** ![Thip2105](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/thip2105/32/708812_2.png) [@Thip2105](https://forums.unrealengine.com/u/Thip2105)\
**Post date:** [April 9, 2024, 4:59pm UTC](https://forums.unrealengine.com/t/how-to-use-a-nested-folders-module-in-verse/1172220/10 "2024-04-09T16:59:45Z")

</div>

this gives an error on the latest release, I see the way modules are written have been changed?
