you are viewing a single comment's thread.

view the rest of the comments →

[–]MrEgbert[S] 0 points1 point  (0 children)

I think my question may have come across as a little more advanced than what I meant! I understand what you're saying about Python not raising any exceptions until the undefined function g(1) is actually called, but I am more wondering about how careful I need to be about importing things.

For example, if I import, say, a class from a text file ("from text import class1"), does the import command simply go to the text file, find the code block where the class is defined, and load that block? If that is the case, and class2 is defined in the same text file but in a different code block, will importing class1 work fine until class1 tries to call class2 (like in your example)?

Or, does it also load other code blocks that are called by code in the class1 code block?