This works if you go into your project settings and change Expressions to Legacy Extend Script
Add null and a ‘Slider Control’ effect to it. Add the expression “Math.floor(value);” to the slider.
Create a composition for all your precomps(All Precomps) and put all of them in it. In the final comp, click the slider control layer and lock the effect controls window so you can access the slider from another composition.
In the first layer of ‘All Precomps’ open opacity, alt-click to add and expression and add
if (pick whip to the slider) == thisLayer.index) 100 else 0
Right click opacity and choose “copy expression”. Select all your other layers and paste the expression.
Drop All Precomps into your main comp, use the slider to pick the layer you need turned on.
See example file if anything is confusing.