What Is Inner Working of Python

So let's go start to see inner working of Python

01_basics/hello_chai.py

def chai(n):
    print(n)

01_basics/chai.py

from hello_chai import chai

chai('ginger chai')

when you run code python python 01_basics/chai.py then you got simple result is ginger chai and also automatically create a directory with a file which name is pycache and inside this directory also have a file which name is based on in which file you import another file (we import hello_chai from chai file) so file name is like this hello_chai.cpython-312.pyc .

when we run our program python 01_basics/chai.py then create a Byte Code this is generally hidden but when we import another code then it is visible.

  1. After create Byte Code then this is fetch and run code in Python VM (virtual machine) this VM install with when we first time install Python in our system.