Is there a way to hide objects from rendering without hiding lighting

Hello there, I have a scene scene made in UE5 and I want to comp Green screen plate inside of the scene. I have some objects that are supposed to be in front of the actors. So my question is, how do i isolate foreground objects but with lighting still affecting them, I have too many light sources and some of them are inside blueprints of background objects, what is the quickest way to achieve what I want?
Thanks in advance for answering

I have a bit of trouble understanding what you exactly are after. Could you clarify this post by updating the information or add some images?