Tensorflow.keras.model not working

I have version 2.16.1 of tensorflow installed and when using it in python it works perfectly. The first 2 lines of code work perfectly:

import tensorflow as tf
from tensorflow import keras

But then the rest doesnt work:

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten, Dense

It doesnt recognize keras.models or keras.layers. What can I do to fix it?

try this

import tensorflow as tf
from tensorflow import keras

from tensorflow.keras import Sequential
from tensorflow.keras.layers import Conv2D, MaxPool2D, Flatten, Dense