# Calling module name using string variable

**URL:** https://discourse.julialang.org/t/calling-module-name-using-string-variable/34632
**Category:** General Usage
**Tags:** question
**Created:** [February 14, 2020, 3:25pm UTC](https://discourse.julialang.org/t/calling-module-name-using-string-variable/34632 "2020-02-14T15:25:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Masicko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/masicko/32/214925_2.png) [@Masicko](https://discourse.julialang.org/u/Masicko)
#### Post date: [February 14, 2020, 3:25pm UTC](https://discourse.julialang.org/t/calling-module-name-using-string-variable/34632/1 "2020-02-14T15:25:56Z")

</div>

Hello,

I would like to specify by string, which module should be used. Something like i have a file foo.jl

```julia
module foo
  something = 1.0
end

```

and in the another file (e. g. the\_main\_file.jl)

```julia
module_name = "foo"

include("$(module_name).jl")
Module(Symbol(module_name)).something

```

The include part is ok, but I am not able to call the module using string. Please, do you have any suggestion? Thanks!

---

<div class="post-metadata">

### Author: ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)
#### Post date: [February 14, 2020, 3:34pm UTC](https://discourse.julialang.org/t/calling-module-name-using-string-variable/34632/2 "2020-02-14T15:34:47Z")

</div>

> [@Masicko](#):
>
> `Module(Symbol(module_name))`

This at most creates a new empty module. Use `eval`.

OTOH, note that you can easily create multiple unrelated copy of the same module this way depending on what you are doing.

---

<div class="post-metadata">

### Author: ![Masicko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/masicko/32/214925_2.png) [@Masicko](https://discourse.julialang.org/u/Masicko)
#### Post date: [February 14, 2020, 3:41pm UTC](https://discourse.julialang.org/t/calling-module-name-using-string-variable/34632/3 "2020-02-14T15:41:55Z")

</div>

Thanks a lot! It works.
