Can't refer to a child (with a different tag) when the parent has a rigidbody 2d

Hi! I’m a big beginner and I have a problem: I made a game in unity2d and make a sprite with children. I use raycasting to click to the child, and the child has a tag to differ from the parent that also have a tag. When I add a rigidbody2d to the parent, I can’t click to the child because the ray senses the parent. I draw the ray and it goes through the child object. Can someone help me?

You can put the parent on the IgnoreRaycast layer or use a Layer Mask with your raycast to ignore the parent.