I'm learning julia (v1.6) and I'm trying to create a julia function to run a julia method from a python class (pycall equivalent) where the method is a print.
I've tried different things and I get different errors either creating the class or calling the method or others.
https://github.com/JuliaPy/PyCall.jl (as a reference)
This is the code I'm using.
using PyCall
# Python Class
@pydef mutable struct python_class
function __init__(self, a)
self.a = a
end
# Julia Method embeded in Python Class
function python_method(self, a)
println(a)
end
# Julia calling python class with julia method
function main(class::PyObject, a::string)
# Instantiate Class
b = class(a)
# Call Method
b.python_method(a)
end
a = "This is a string"
# Run it
main(python_class, a)
end
expected output is the equivalent to print('This is a string') in python.
Can somebody help me to make it work please?
Thank you in advance
This all seems to work except that you have one
end
in wrong place and it should beString
notstring
.