I’ve recently installed recessed lighting in my bedroom . It was a DIY project for my dad and he accidently cut a hole and it just so happened there was a stud there. Now I have a 6 inch hole to fix. Does anyone know how to repair a hole in a popcorn textured ceiling? I still have the part that was cut out from the ceiling. Do I need it?

you could try placing the part back up with no nails glue around the edges and on the back then polyfill around the edge and paint it in to match ,but it will be hard to match,or you could nail the piece back into the joist and using a punch drive the nails into just above the surface then fill over the nail heads with filler then paint over.
Spackle it and then get spray on texture.