Render a scene twice but once it renders with an extra object
Ok i figured it out, in blender 2.79 they had something called render layers, in 2.8, and 2.9 they use view layers, to do this you will see ticks in the outliner, and unticking them will make them not be rendered, and in the top right there is a section called view layers, if you duplicate them with the same settings you can tick or untick each one and then composite them together