Closed hubert-associates closed 11 months ago
You can do imports in the code:
julia> @pyexec """
import numpy
x = numpy.zeros((2,3))
""" => x;
julia> x
Python:
array([[0., 0., 0.],
[0., 0., 0.]])
Or you can do the import once in a separate command:
julia> @pyexec """
global numpy
import numpy
"""
julia> @pyexec """
x = numpy.zeros((2,3))
""" => x;
julia> x
Python:
array([[0., 0., 0.],
[0., 0., 0.]])
Sincere thanks for the promt answer "user's guide" content. I think I was missing the "global". I'll close once I'm sure...
I'm trying to use pyexec or @pyexec as shown here , but I need some imports (numpy, azure.cosmos, os...). Anywhere/Anyway to document how that works? Thanks for the great PythonCall.jl.
https://discourse.julialang.org/t/define-python-function-in-julia-file-with-pythoncall/98593/5