Design is basically sound. Setting motors inside the section has probably occurred to most people at some point. If worked hard they may reach 80 degrees or more so you may want vent holes in the section.

I can't see how the gantry cross beam connects to the platforms it sits on apart from the small angle bracket. You will need more than that. You can bolt down through lower inner edge of the gantry into the platform on the rectangle and possibly the square if you can get a tool inside. Or if you can weld then cap off the end of the section and drill and tap to fix the side plates. Popular way to do it for steel.

Alum profile was mentioned and this is another way to do it as you can easily tap the ends.

I would go steel as it is stiffer but both can work.