In python you can do something like this to dynamically detect if an object has a method and then dynamically get a reference to it and call it: if hasattr(obj, "some_method"): func = getattr(obj, "some_method") func() Is there an equivalent way to do this using Nim? In my case, this all has to be done at runtime, since the type of obj could be one of several option. I'm trying to port some python code to Nim and this is a pattern I used for the original python code.