Follow:get_target_dist_and_vel_ned() returns a nil value method error

In ardupilot AP_Follow.cpp, there’s a method defined as AP_Follow::get_target_dist_and_vel_ned(), but I cannot call this function from a lua script in mission planner, as I just get a nill method error. I’m using the follow object to call this function btw, so follow:get_target_dist_and_vel_ned(). This method is also used in plane_follow.lua script by Tim The Plane Man from youtube in this video. Some other methods such as follow:get_distance_to_target() also results in nill exception. How can I fix this problem?