# Accesing A Module's Structure

**URL:** <https://forum.elixirforum.com/t/accesing-a-modules-structure/1850>\
**Category:** Questions\
**Created:** [October 2, 2016, 3:57am UTC](https://forum.elixirforum.com/t/accesing-a-modules-structure/1850 "2016-10-02T03:57:27Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![g4143](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/a88e57/32.png) [@g4143](https://forum.elixirforum.com/u/g4143)\
**Post date:** [October 2, 2016, 3:57am UTC](https://forum.elixirforum.com/t/accesing-a-modules-structure/1850/1 "2016-10-02T03:57:27Z")

</div>

How does one access/create the structure Inode, defined below, from another module?

```elixir
defmodule Cont.Expr do

  defmodule Inode do
    defstruct value: 0
  end

end

```

---

<div class="post-metadata">

**Author:** ![christopheradams](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/christopheradams/32/1139_2.png) [@christopheradams](https://forum.elixirforum.com/u/christopheradams)\
**Post date:** [October 2, 2016, 4:08am UTC](https://forum.elixirforum.com/t/accesing-a-modules-structure/1850/2 "2016-10-02T04:08:26Z")

</div>

```
inode = %Cont.Expr.Inode{}

```

---

<div class="post-metadata">

**Author:** ![g4143](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/a88e57/32.png) [@g4143](https://forum.elixirforum.com/u/g4143)\
**Post date:** [October 2, 2016, 4:16am UTC](https://forum.elixirforum.com/t/accesing-a-modules-structure/1850/3 "2016-10-02T04:16:42Z")

</div>

> [@christopheradams](#):
>
> inode = %Cont.Expr.Inode{}

Tried that and got:  
(CompileError) Cont.Expr.Inode. **struct** /1 is undefined, cannot expand struct Cont.Expr.Inode

Actually I think this might be a problem with the Atom/Elixir because I can compile and run this code

```elixir
inode = %Cont.Expr.Inode{value: 1234}

IO.inspect inode

```

And it ouputs

```elixir
%Cont.Expr.Inode{value: 1234}

```

And Atom/Elixir displays this:

```elixir
(CompileError) Cont.Expr.Inode. __struct__ /1 is undefined, cannot expand struct Cont.Expr.Inode

```

---

<div class="post-metadata">

**Author:** ![josevalim](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/32/1787_2.png) [@josevalim](https://forum.elixirforum.com/u/josevalim)\
**Post date:** [October 2, 2016, 6:23am UTC](https://forum.elixirforum.com/t/accesing-a-modules-structure/1850/4 "2016-10-02T06:23:06Z")

</div>

Where are you placing your files? How is you or your editor compiling them? `mix compile`?

---

<div class="post-metadata">

**Author:** ![g4143](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/a88e57/32.png) [@g4143](https://forum.elixirforum.com/u/g4143)\
**Post date:** [October 2, 2016, 6:54am UTC](https://forum.elixirforum.com/t/accesing-a-modules-structure/1850/5 "2016-10-02T06:54:37Z")

</div>

Yeah I’m using mix(mix escript.build) to compile and I’m placing all the files in the projects lib folder which is generated by mix new main.

---

<div class="post-metadata">

**Author:** ![josevalim](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/32/1787_2.png) [@josevalim](https://forum.elixirforum.com/u/josevalim)\
**Post date:** [October 2, 2016, 7:20am UTC](https://forum.elixirforum.com/t/accesing-a-modules-structure/1850/6 "2016-10-02T07:20:41Z")

</div>

I would double check the file extensions. If that still does not work, can you push the project to Github or something that reproduces the error?

---

<div class="post-metadata">

**Author:** ![g4143](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/a88e57/32.png) [@g4143](https://forum.elixirforum.com/u/g4143)\
**Post date:** [October 2, 2016, 2:42pm UTC](https://forum.elixirforum.com/t/accesing-a-modules-structure/1850/7 "2016-10-02T14:42:25Z")

</div>

Here you go. This reproduces the error I am having with Atom/Elixir.

> **[Bitbucket](https://bitbucket.org/G4143/atom-elixir/src/0c6c94aaf05d?at=master)**

---

<div class="post-metadata">

**Author:** ![josevalim](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/32/1787_2.png) [@josevalim](https://forum.elixirforum.com/u/josevalim)\
**Post date:** [October 2, 2016, 9:55pm UTC](https://forum.elixirforum.com/t/accesing-a-modules-structure/1850/8 "2016-10-02T21:55:54Z")

</div>

I could not reproduce it. What is your Elixir version?

---

<div class="post-metadata">

**Author:** ![g4143](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/a88e57/32.png) [@g4143](https://forum.elixirforum.com/u/g4143)\
**Post date:** [October 3, 2016, 12:02am UTC](https://forum.elixirforum.com/t/accesing-a-modules-structure/1850/9 "2016-10-03T00:02:30Z")

</div>

My Elixir version is 1.3.3

I wonder if its a problem with the plugins with Atom because Eliixir will compile the code without complaint but the Atom editor+plugins will display the posted error message.

---

<div class="post-metadata">

**Author:** ![josevalim](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/32/1787_2.png) [@josevalim](https://forum.elixirforum.com/u/josevalim)\
**Post date:** [October 3, 2016, 12:22am UTC](https://forum.elixirforum.com/t/accesing-a-modules-structure/1850/10 "2016-10-03T00:22:22Z")

</div>

That sounds like it. Try filing a report on their elixir plugin/extension.

---

<div class="post-metadata">

**Author:** ![g4143](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/a88e57/32.png) [@g4143](https://forum.elixirforum.com/u/g4143)\
**Post date:** [October 3, 2016, 1:14am UTC](https://forum.elixirforum.com/t/accesing-a-modules-structure/1850/11 "2016-10-03T01:14:31Z")

</div>

I’m just glad that issue is solved(for me). Do you know how confusing it is to see an error pop-up in the editor indicating something is incorrect when it really isn’t?

Thank-you everyone for helping with this problem. I’ll file the report today.
