How to get the argument count of a callable

Godot Version

4.2.1 stable


I’m working on making a plugin, and I want to allow the user to bind arbitrary callables. For type safety, I want to know what the signature of the arguments is (i.e. the argument count, the types of the arguments, arg names, etc.)

Unfortunately, the Callable object doesn’t seem to have any way of doing this. Is there any method to get this data from an arbitrary callable?

I don’t know much about this, but have you tried calling get_bound_arguments() on the callable?

1 Like

You may have to keep a dict of the data you need so that you can reconstruct that in other places.

That function just returns the arguments that have been given to the function, it doesn’t work for my purpose sadly :confused:

1 Like

I think this may be what I need to do. Just wish there was a way to automatically handle it.