Does Python import statement also import dependencies automatically?
问题 I have the following file app.py class Baz(): def __init__(self, num): self.a = num print self.a def foo(num): obj = Baz(num) and the second file main.py from app import foo foo(10) Running the file python main.py gives the correct output. Now in the second file, I'm just importing the function not the class, although successful execution of my function requires the class as well. When importing the function does Python automatically import everything else which is needed to run that function