Hello everyone. Right now I’m learning the modules.
We’ve got 2 files** “script.py” **and **“functions.py” **(<- in this file we defined some functions)
Let’s *import * the functions of “functions.py” into ** “script.py” ** (they are in the same folder)
So we have two options:
Import functions
or
from functions import function_x, function_y
In ** “functions.py” **outside of definitions let’s write print(“something”)
It’s gonna be printed out for Import functions
, which is normal as I think, because we import the entire file.
However, it’s gonna be printed out for from functions import function_x, function_y
as well, that can’t understand, because there we specified what function we want to import and from what file. Nothing else.
So, theprint(“something”)
IS outside the definitions we asked to import, how is it getting imported?
If it’s gonna be printed out, anyways, so why did we specify each function one by one carefully?