Calling GDextension custom module method in GDscript

Godot Version

4.2.2

Question

I have successfully built my GDextension module and am able to add my custom node to a godot project. The problem I’m encountering occurs when I try to call any of the public methods I have bound and exposed to the inspector.

When I right click my node and view the documentation I can see the binded methods, so I’m pretty sure I have exposed them correctly.


However, when I try to call one of these methods using self.calibrate_camera(img_dir) with a script attached to my custom node I get the error “Function calibrate_camera() not found in base self.”

Here is the line where i bind the method:

    ClassDB::bind_method(D_METHOD("calibrate_camera", "image directory"), &CalibratedCamera::CalibrateCamera);

and the function header:

void CalibratedCamera::CalibrateCamera(const godot::String imageDir)

Do I have to call the method another way? Perhaps using self.call()

you should be able to call it just with ‘calibrate_camera(img_dir)’ no need even for self reference.

maybe you are referencing wrong object?
Your script should be inherited from your custom class.