Do the motors run from two AA batteries (3V)? If so what stall current do they take?
The L298 wastes 2.5V or more and is unsuitable for low voltage use. You'd ideally want 9..12V motor, 12V supply and L298 if you want it to work. Modern MOSFET motor drivers are way more performant.
That battery isn't going to cut it, standard PP3 sized 9V batteries are for low current devices. These days there are some that have LiPo internally and are high current (but are actually 7.4V, not 9V). What's likely happening with the battery is the stall current demand of the motor pulls its voltage down to a few volts and the L298 gets insufficient voltage to work.
Even tiny motors tend to need at least 1A, its best to characterise the motors first.