# Dot in module name

**URL:** <https://discourse.elm-lang.org/t/dot-in-module-name/619>\
**Category:** Learn\
**Created:** [February 4, 2018, 3:08am UTC](https://discourse.elm-lang.org/t/dot-in-module-name/619 "2018-02-04T03:08:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michal.Blazejczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/michal.blazejczyk/32/144_2.png) [@Michal.Blazejczyk](https://discourse.elm-lang.org/u/Michal.Blazejczyk)\
**Post date:** [February 4, 2018, 3:08am UTC](https://discourse.elm-lang.org/t/dot-in-module-name/619/1 "2018-02-04T03:08:21Z")

</div>

Hi,

I am confused. I have code like this:

BannersView.elm:

> module Banners.View exposing (view)  
> – …

Main.elm:

> – …  
> import Banners.View  
> – …  
> Banners.View.view …

This produces the following error at compile time:

> I cannot find module ‘Banners.View’.
> 
> Module ‘ZKMain’ is trying to import it.
> 
> Potential problems could be:
> 
> - Misspelled the module name
> - Need to add a source directory or new dependency to elm-package.json

However, if I remove the dot from the module name (i.e. name it BannersView), everything compiles fine.

Is there some trick in elm-package.json to make the name with a dot work correctly?

Best,  
Michal

---

<div class="post-metadata">

**Author:** ![tomjschuster](https://avatars.discourse-cdn.com/v4/letter/t/b5e925/32.png) [@tomjschuster](https://discourse.elm-lang.org/u/tomjschuster)\
**Post date:** [February 4, 2018, 4:17am UTC](https://discourse.elm-lang.org/t/dot-in-module-name/619/2 "2018-02-04T04:17:50Z")

</div>

In Elm, the module name needs to be the same as the file name, and the prefixes need to be the same as the path of the file within a source directory.

If you want your module to be named `Banners.View`, you’ll need to name the file `View.elm` and place it in a folder named `Banners` within a source directory:

```auto
   .
   | - src
   | | - Banners
   | | | - View.elm
   | | 
   | | - Main.elm
   |
   | - elm-package.json

```

---

<div class="post-metadata">

**Author:** ![Michal.Blazejczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/michal.blazejczyk/32/144_2.png) [@Michal.Blazejczyk](https://discourse.elm-lang.org/u/Michal.Blazejczyk)\
**Post date:** [February 5, 2018, 10:42pm UTC](https://discourse.elm-lang.org/t/dot-in-module-name/619/3 "2018-02-05T22:42:42Z")

</div>

Hi,

Thanks! I expected something of the kind, but couldn’t find any documentation.

So it won’t work even if I name the file Banners.View.elm?

I’ll just keep the name without the dot, then, because the file resides in directory called Pages which makes more sense to me 🙂

Best,  
Michal
