# Syntax error: 'invalid interpolation syntax' when using include()

**URL:** https://discourse.julialang.org/t/syntax-error-invalid-interpolation-syntax-when-using-include/52732
**Category:** New to Julia
**Tags:** question, strings, error, string-interpolation
**Created:** [January 2, 2021, 10:28am UTC](https://discourse.julialang.org/t/syntax-error-invalid-interpolation-syntax-when-using-include/52732 "2021-01-02T10:28:39Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![MattWillFlood](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattwillflood/32/20722_2.png) [@MattWillFlood](https://discourse.julialang.org/u/MattWillFlood)
#### Post date: [January 2, 2021, 10:28am UTC](https://discourse.julialang.org/t/syntax-error-invalid-interpolation-syntax-when-using-include/52732/1 "2021-01-02T10:28:39Z")

</div>

Hi Guys,  
I’m new-ish to Julia and so far things have been great, but this syntax error has really stumped me. 🤷🏼‍♂️

Here’s the background.

- I have several files called \_Aa.jl, \_Bb.jl, and so on.
- Each one contains a module of the same name (\_Aa, \_Bb,…).
- I can import the modules in most cases with no trouble:

```julia
include("_Aa.jl")
Main._Aa

@isdefined _Aa 
true

```

However, when I try to do this for a file called “\_MSEn.jl” the following error is thrown:

```julia
include("_MSEn.jl")
ERROR: syntax: invalid interpolation syntax

```

And the file definitely exists…

```julia
isfile("_MSEn.jl")
true

```

Could somebody please explain why this happens and/or what I have overlooked? 🙏 🙏

Thanks in advance! 🙂

---

<div class="post-metadata">

### Author: ![magister-ludi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/magister-ludi/32/4003_2.png) [@magister-ludi](https://discourse.julialang.org/u/magister-ludi)
#### Post date: [January 2, 2021, 12:48pm UTC](https://discourse.julialang.org/t/syntax-error-invalid-interpolation-syntax-when-using-include/52732/2 "2021-01-02T12:48:05Z")

</div>

It looks to me like you probably have a typo in the file. What does it contain? That error message suggests that you’ve got a string containing a `$` and Julia is trying to interpolate something incorrectly.

---

<div class="post-metadata">

### Author: ![MattWillFlood](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattwillflood/32/20722_2.png) [@MattWillFlood](https://discourse.julialang.org/u/MattWillFlood)
#### Post date: [January 2, 2021, 1:13pm UTC](https://discourse.julialang.org/t/syntax-error-invalid-interpolation-syntax-when-using-include/52732/3 "2021-01-02T13:13:43Z")

</div>

Thank you so much **magister-ludi**! 🙌🏼  
That was the problem exactly.

I had misinterpreted the error as relating to the filename string (i.e. include(“_ **filename** _”)) as opposed to strings contained within the file…

Your help is really appreciated! 🙂 👍🏼

---

<div class="post-metadata">

### Author: ![magister-ludi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/magister-ludi/32/4003_2.png) [@magister-ludi](https://discourse.julialang.org/u/magister-ludi)
#### Post date: [January 2, 2021, 11:24pm UTC](https://discourse.julialang.org/t/syntax-error-invalid-interpolation-syntax-when-using-include/52732/4 "2021-01-02T23:24:45Z")

</div>

No worries. There are a lot of complaints about Julia’s error messages, but as with any language, it takes time and practice to be able to interpret them productively.

---

<div class="post-metadata">

### Author: ![Alexandre\_Bergel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexandre_bergel/32/37951_2.png) [@Alexandre\_Bergel](https://discourse.julialang.org/u/Alexandre_Bergel)
#### Post date: [July 14, 2022, 10:19am UTC](https://discourse.julialang.org/t/syntax-error-invalid-interpolation-syntax-when-using-include/52732/5 "2022-07-14T10:19:24Z")

</div>

I bumped into the same error today. I was able to reproduce it with:

```julia
julia> println("$(1,2)")
ERROR: syntax: invalid interpolation syntax
Stacktrace:
 [1] top-level scope
   @ none:1

```

One way to avoid the error is simply adding parenthesis:

```julia
julia> println("$((1,2))")
(1, 2)

```
