How do you design a mold to create that part? The only way I can think of is to make the parting line horizontal to the part instead of vertical. But is there any way to design the mold so that the parting line is vertical like in the picture?
Yes, this can be done as follows. The multiplicity of through-holes in the sidewalls of the part can be created using what's called a slide populated with small square pins that are moved in by hydraulic pressure or a mechanical cam to shut off against the male core in the mold. The part is extracted from the mold by withdrawing the slides and stripping the finished part off the core.
The pins are machined with standard draft angles on their sides to accomodate the particular type of resin being molded, and the standard practices of the molding shop.
Good design usually includes pockets in the core into which these pins fit closely, to get good shutoff action without leaving a thin skin of plastic blocking the hole (which is called flash).
The actuation means inside the mold is generically referred to as a mechanism or a cam and a mold having slides actuated by hydraulics is called a hydraulic. A mold having a mechanism, cam or hydraulic system built into it is referred to as complex.