Select all objects in a Object

I ask chat gpt to write me a script to hide all objects which are in an Object. Imagine we have a sphere and we have a second sphere in it. so i want du select both and the inner sphere should be selected and moved to a separate layer.

It sounds so good but it doesn’t work.

U have tipps how a achieve it.

Thats just the idea, when we scale this than we can hide 1000 of objects in a object

Hello - SelVolumeObject should do this but it is not always 100% reliable it seems.