I am importing a module named as dependency.py inside another module app.py. I am curious to know that when I compile app.py into app.pyc, does app.pyc include the byte code of relevant code segment from dependency.py ? Or does app.pyc include an instruction to open and read from dependency.py?
app.py is as follows:
from dependency import myfunc
print("inside app.py")
myfunc()
dependency.py is as follows:
def myfunc():
print("inside dependency")
Now there are two possible scenarios:
scenario 1. app.pyc looks like
byte code corresponding to <print("inside app.py")>
byte code corresponding to <print("inside dependency")>
scenario 2. app.pyc looks like
byte code corresponding to <print("inside dependency")>
byte code corresponding to the instruction <open dependency.py and then read what myfunc means>
I tried to run app.pyc after deleting dependency.py and it throws error saying - ModuleNotFoundError: No module named 'dependency'. So it seems that scenario 2 is true. But I don't have a cs background and new in programming world, So I'm asking you if I am right or something different is happening?