Mastery14. Creating and using a Python module

Modules are Python files that contain pre-built functions that are very useful. Python already has some modules that come with it at the moment you download it but we can create our own modules too.

To create a modules we have to create a new file with the extension .py and save it on the main folder of python because there is where python looks after we call a function. The direction of this folder can be found on C:Python34 but this may be different depending on what version of Python you have.

In this file we have to create the functions that we are going to use after importing the module. If you dont know how to create a function you can check a post I did where I explain it in here: https://manuelmadrigal.withknown.com/2015/mastery12-creating-python-functions

After this file is created we have to import it in the new file where we want to use this functions. You can also check my post about Importing and using python modules in here: https://manuelmadrigal.withknown.com/2015/mastery13-importing-and-using-python-modules

If you want to learn more about Creatin and Using Python functions you can check this video:https://www.youtube.com/watch?v=xRQA1Fy1HFQ

 

CC BY 4.0 Mastery14. Creating and using a Python module by Manuel Madrigal is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.