Function is not a Python Function

Hi,
i’ve stumbled upon a weird error in ghpython:
as I’m trying to execute a very simple piece of code (basic implementation of scipy.optimize.curve_fit):

def func(x,k1,k2):

  • return k1 * x + k2*

xdata = [661.657, 1173.228, 1332.492, 511.0, 1274.537]
ydata = [242.604, 430.086, 488.825, 186.598, 467.730]
popt, pcov = spo.curve_fit(func, xdata, ydata)

it shows me a following error: Runtime error (Exception): <function func at 0x0000000000003949> is not a Python function

The same code in VSC works without any problem. I guess there is something with IronPython, or?
I didn’t find any info in google and will be very glad, if someone could explain me, what’s wrong?
I use ghpythonremote for scipy, Rhino 7.

Probably a conflict between IronPython and CPython.