# Calling Julia from Python with subprocess

**URL:** <https://discourse.julialang.org/t/calling-julia-from-python-with-subprocess/63939>\
**Category:** General Usage\
**Tags:** python\
**Created:** [July 2, 2021, 2:00pm UTC](https://discourse.julialang.org/t/calling-julia-from-python-with-subprocess/63939 "2021-07-02T14:00:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![FabVonBellingshausen](https://avatars.discourse-cdn.com/v4/letter/f/b2d939/32.png) [@FabVonBellingshausen](https://discourse.julialang.org/u/FabVonBellingshausen)\
**Post date:** [July 2, 2021, 2:00pm UTC](https://discourse.julialang.org/t/calling-julia-from-python-with-subprocess/63939/1 "2021-07-02T14:00:38Z")

</div>

I am trying to call a Julia script from a Python script using the subprocess module from the Python standard library (I tried using PyJulia but couldn’t get it to run), as follows:

```julia
cmd = "foo.jl bar"            
subprocess.run(cmd, shell = True) 

```

However this seems to be very slow, similar to launching the Julia REPL from the command line. Is there any way to make this quicker?

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [July 2, 2021, 4:43pm UTC](https://discourse.julialang.org/t/calling-julia-from-python-with-subprocess/63939/2 "2021-07-02T16:43:31Z")

</div>

This will include compilation time for your script each time you run it.  
I think PyJulia should be the way to go, what issues did you encounter?
