Why server does not start a kernel when i run a .py file in the terminal opened in jupyter front end?

I noticed that the jupyter server will not start a kernel when i directly run a .py file and how does it implement when I import a .py file in a .ipynb file? Does the codes in .py file will be sent to the IPython kernel or just start a terminal with python?