Issue with MPU6050 and L298N

So ive been trying to make a balance robot with 2 dc motors using an L298N and MPU6050.

I have a very simple code that gets the tilt numbers and rotates the motors according to that data.
But when i connect L298N(with motors connected to it) to my arduino nano, the mpu6050's tilt data just stops. I mean i cant even see it on the serial monitor. It just stops. I have checked the sensor and its led stays on all the time. But when i connect the l298n, it runs ok for about 2 seconds and then the data stops flowing.

Notes : Im using a 12v 4.5A external power supply for the project. I ve also tried separating arduino and motor drivers power supply's but it didnt help.

What am i supposed to do at this point to get constant data from the MPU6050 ?

We can't see your code. We can't see how your project is wired. I don't know how that we can help you without that information.

Please read the how to use this forum sticky to see how to post your code properly and some advice on what information that you need to provide so that we can offer intelligent assistance. See #7 & 11 especially.

Also post a link to the motor data sheet or product page. The ancient, inefficient L298N is a poor choice and may not work with the motors.