# Importing a julia variable into python using PyCall

**URL:** https://discourse.julialang.org/t/importing-a-julia-variable-into-python-using-pycall/92470
**Category:** General Usage
**Tags:** python
**Created:** [January 3, 2023, 11:14pm UTC](https://discourse.julialang.org/t/importing-a-julia-variable-into-python-using-pycall/92470 "2023-01-03T23:14:38Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Nash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nash/32/14482_2.png) [@Nash](https://discourse.julialang.org/u/Nash)
#### Post date: [January 3, 2023, 11:14pm UTC](https://discourse.julialang.org/t/importing-a-julia-variable-into-python-using-pycall/92470/1 "2023-01-03T23:14:38Z")

</div>

Why does the following code produce an error?

```julia
A = 2+2
py"""
B = 2
C = A + B
"""

```

The error produced is:

NameError(“name ‘A’ is not defined”)

I guess that I need to pass A into the pycall, but how?

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [January 3, 2023, 11:58pm UTC](https://discourse.julialang.org/t/importing-a-julia-variable-into-python-using-pycall/92470/2 "2023-01-03T23:58:09Z")

</div>

You need to interpolate with `$`, as is [explained in the documentation](https://github.com/JuliaPy/PyCall.jl#calling-python):

```julia
julia> A = 2+2
4

julia> py"""
       B = 2
       C = $A + B
       """

julia> py"C"
6

```
