# Calling a julia script from within another script

**URL:** https://discourse.julialang.org/t/calling-a-julia-script-from-within-another-script/100989
**Category:** General Usage
**Tags:** question
**Created:** [June 29, 2023, 5:21pm UTC](https://discourse.julialang.org/t/calling-a-julia-script-from-within-another-script/100989 "2023-06-29T17:21:46Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![algunion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/algunion/32/51630_2.png) [@algunion](https://discourse.julialang.org/u/algunion)
#### Post date: [June 30, 2023, 10:51am UTC](https://discourse.julialang.org/t/calling-a-julia-script-from-within-another-script/100989/7 "2023-06-30T10:51:46Z")

</div>

Here is how you can do it if you (for any reason) prefer this approach.

Let’s put this in the script to be called from another script (let’s say `A.jl`):

```julia
x = ARGS[1]
callx(x) = parse(Int, x) + 1
println(callx(x))

```

Now, in the script that will call/execute `A.jl`, we can add (let’s call this `B.jl`):

```julia
myx = 5
output = readchomp(`julia A.jl $myx`)
println("I received: $output from script execution of A.jl...")

```

Now, if I go in terminal and run:

```bash
julia B.jl

```

… you’ll see the script `B.jl` calling `A.jl` and you’ll get the following output:

```julia
I received: 6 from script execution of A.jl...

```

In this way, you don’t need to care about what the functions are called inside `A.jl` - you just need to make sure you are printing stuff to `stdout`.

Have fun.

---

_[View the full topic](https://discourse.julialang.org/t/calling-a-julia-script-from-within-another-script/100989)._
