The global keyword in Python is used to access and modify global variables from within a function's local scope. It tells Python that a variable assigned in a function should refer to a global variable. Otherwise, Python will create a local variable of the same name.
A scope is the extent of visibility and accessibility of named entities such as variables, functions, and classes, within a program. It determines where in your code you can access a particular name or identifier. There are three types of Python scopes: build-in, global, and local.
The Python __name__ variable is a special built-in variable that holds the name of the current imported module. When accessed within a Python script file that's executed directly (i.e. not a module), its value is the string "__main__". __name__ is most often used to differentiate between Python code that is run in a standalone script or code that's imported as a module.
A Python package is a directory that contains one or more modules. Python packages allow developers to structure their code into logical units, making it easier to manage, reuse, and share. They also facilitate the installation and distribution of Python code through tools like pip, making it simple for others to use your code in their projects.
It's possible to designate directories on disk in which Python searches for modules. Those directories and the sequence in which they are searched are called the Python module search path. When Python executes an import statement to load a module, it follows the search path to locate the module file.