Efficient programming of integrated small optical sources is a key component of photonic technologies. However, as the density of laser arrays increases, the miniaturization and scalability of laser control using an electric drive are pushed to the limit. This study presents an all-optical drive scheme for complete programming of nanolaser arrays through a single waveguide port. Three photonic crystal nanolasers, printed three-dimensionally on the sides of a 2-µm-diameter fiber with an 18 µm laser spacing, were entirely controlled by modal interference, adjusted by the polarization and pulse width of the pump beam through the same fiber. Our approach is applicable to various small optical sources coupled to a single waveguide, and it will lay the foundation for applications in high-density optical integrated circuits, biosensing, and quantum network technologies.