Importing a julia variable into python using PyCall

You need to interpolate with $, as is explained in the documentation:

julia> A = 2+2
4

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

julia> py"C"
6
1 Like