I am getting above error when trying to obj.ray_cast() from a copy of an object:
obj = bpy.data.scenes[0].objects["Sphere"].copy()
is_hit, hit_loc, hit_normal, index = obj.ray_cast(localA, localB)
I figured out this was due to objects being linked. Making object data single user solved this issue. However, I need to keep it linked. Is there a way to keep objects in linked state and still use the ray_cast() function?