Need help with Break Beam Sensor
You can use these but the invisible IR light ought to be confined so it does not spread out and bounce off anything. I usually mount both  behind an aperture  with a deep hole only small enough to see the target behind the object blocking the recessed light path, which is only 3mm, but a 4mm hole x 10mm deep might be ok to ease alignment of the single piece assembly around the tube.  Trial and error may be necessary so it ignores stray light yet is not attenuated too much thru the plastic tube.  There will be light scattering and diffraction but how much is hard to say.

It says that it reaches 10" but with LED angle of 10 degrees that reflects a big target so your range is reduced with this and a more powerful break sensor ( eg 5mm LED) is needed. Your contraption might work but the light must not wrap around the clear cylinder and get in. A visible LED can be used to see how light refracts into your receive aperture, for understand and alignment is key.

da specs


Power Voltage: 3.3 - 5.5VDC
Emitter Current Draw: 10mA @ 3.3V, 20mA @ 5V
Output Current Capability of receiver: 100mA sink
Transmitter/Receiver LED Angle: 10°
Response Time: &lt;2 ms


Since the output is an open collector switch to ground of 100 mA, you can amplify this max current with another transistor FET or PNP emitter follower or low side of a relay to drive your solenoid with a reverse biased clamp diode to its DC  supply.

Details depend on your load.

Position depends on the inertia of motor after current is open.  The surge current of your motor is typically 8~10x its rated current, so plan on this.

p.s. I might be inclined to adhere them into the acrylic or polycarbonate tube if it looked like it might work. But try on a sample first. Get two they're cheap. Use Shielded pairs for everything to avoid motor cutoff re-triggering the sensor. Maybe an RF cap on output...