Imports and the entry point
Learn in depth →Import locates and initializes a module, normally caching it in sys.modules. __name__ identifies its execution context.
import package.module
if __name__ == "__main__": ...Example
import math
print(math.isqrt(17))Result
4
Watch for: A local file named like a standard module can shadow it. An import may execute module-level code.
Practise this topic →