Python script to apply selective Simplify in a complex scene?

I have a scene that consists of close, and relatively far objects at a certain camera angle. In the viewport (and render too if possible) I would like to apply “simplify” to those far objects only as their details will only be an overload to the RAM. Is there a script I can apply or something?

I don’t know of selective simplify. But you could add a decimate modifier to objects in the background, depending on the topology it could to a good job.

I think there are some parameters in the render panel
that can help with that
check out the manual for render settings

happy bl