# Calling functions from another script

**URL:** <https://discourse.julialang.org/t/calling-functions-from-another-script/109978>\
**Category:** New to Julia\
**Tags:** functions\
**Created:** [February 9, 2024, 11:07am UTC](https://discourse.julialang.org/t/calling-functions-from-another-script/109978 "2024-02-09T11:07:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mishal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mishal/32/214462_2.png) [@Mishal](https://discourse.julialang.org/u/Mishal)\
**Post date:** [February 9, 2024, 11:07am UTC](https://discourse.julialang.org/t/calling-functions-from-another-script/109978/1 "2024-02-09T11:07:31Z")

</div>

Hi Guys

I am currently converting my FEM toolbox I made on Matlab to Julia. I am having issues calling functions from other scripts.

the function is:

```julia
function assembly(q, T, ke, npe, dof, n)
    # Create a blank global stiffness matrix
    a = size(n)
    m_size = dof * n[a[1], 1]
    Kdummy = zeros(m_size, m_size)

    nodes = T[1, 2:npe+1]'
    A = zeros(npe, dof)
    for i = 1:npe
        A[i, :] = q[nodes[i], :]
    end

    B = reshape(A, npe * dof, 1)
    Q = sort(B)

    Kdummy[Q, Q] .= ke .+ Kdummy[Q, Q]
    return Kdummy, A, Q
end

```

This is how I am calling the script:

```julia
include("C:\Users\mishal.mohanlal\Downloads\Mishal FEM files Julia\FEM files\FEM-functions.jl")

```

This is the error I get:

ERROR: syntax: invalid escape sequence  
Stacktrace:  
[1] top-level scope  
@ c:\Users\mishal.mohanlal\Downloads\Mishal FEM files Julia\FEM files\test.jl:1

ERROR: syntax: invalid escape sequence  
Stacktrace:  
[1] top-level scope  
@ c:\Users\mishal.mohanlal\Downloads\Mishal FEM files Julia\FEM files\test.jl:1

ERROR: syntax: invalid escape sequence  
Stacktrace:  
[1] top-level scope  
@ c:\Users\mishal.mohanlal\Downloads\Mishal FEM files Julia\FEM files\test.jl:1

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [February 9, 2024, 11:28am UTC](https://discourse.julialang.org/t/calling-functions-from-another-script/109978/2 "2024-02-09T11:28:06Z")

</div>

It might be due to the backslash `\` in the file path, try using a `raw""` string, i.e.,

```julia
include(raw"C:\Users\mishal.mohanlal\Downloads\Mishal FEM files Julia\FEM files\FEM-functions.jl")

```

---

<div class="post-metadata">

**Author:** ![dkzwart](https://avatars.discourse-cdn.com/v4/letter/d/48db29/32.png) [@dkzwart](https://discourse.julialang.org/u/dkzwart)\
**Post date:** [February 9, 2024, 2:58pm UTC](https://discourse.julialang.org/t/calling-functions-from-another-script/109978/3 "2024-02-09T14:58:11Z")

</div>

Your error is invalid escape sequence. The “\” is an escape character, meaning the next character is viewed differently. @baggepinnen’s solution should work.

[https://docs.julialang.org/en/v1/manual/strings/#man-raw-string-literals](https://docs.julialang.org/en/v1/manual/strings/#man-raw-string-literals)

The following should also work:

> include(“C:\Users\mishal.mohanlal\Downloads\Mishal FEM files Julia\FEM files\FEM-functions.jl”)

Or the following:

```julia
include("C:/Users/mishal.mohanlal/Downloads/Mishal FEM files Julia/FEM files/FEM-functions.jl")

```
