A python package is a collection of python module s. These modules are python scripts with *.py file extension. Typically, these scripts will contain python functions, classes, custom data types etc. Looking at the figure above, the Game package consist of an _init_.py file together with 3 other sub-packages Sound, Image and Level respectively. The _init_.py file must be included inside a directory for it to be considered a python package.In addition, the directory must be defined inside sys.path. Example usage: 1. import Game.Level.Start Suppose the start.py module consists of a function called mince() Inside your python application, you would need to call it as follows 2. Game.Level.Start.mince(<input_params>) Alternatively, you can reference it as follows 3. from Game. Level import Start // recommended approach 4. Start.mince(<input_params>) A less common method is calling the function as if it was defined inside your curr...
Key points to everything including python, data science, machine learning and web hosting.