So you can use existing Python modules,
but you can also create your own module if you want to.
Here I'm not going to explain every possible thing
about module creation, just the basics to get you started.
And I'm going to go back to the add to inst.py that we have written previously.
Here we have a function to add two numbers.
Let's say now I want to use that function in a different file.
So what I'm going to do, I'm going to copy and paste
this function every time I need to use it, which is really not convenient.
So I'm going to create a new file here, new Python file,
and I'm going to name it my computations.py,
which is going to be the name of the module, my computations.
I'm going to take the function here, put it in my computations.py.
And well, that is simply the module for now,
which contains a file name and then one function.
And so in this module, you can add as many functions as you want.
Make sure you don't add a code like this,
code that is going to run when you call the file.
So just add functions, don't write any other code, just functions.
And now let's go back to the add to inst.py.
I'm going to remove that function.
And so you can see now we have an error, because add to numbers is not recognized.
What I'm going to do, I'm going to do import my computation.
And I'm going to do here my computations.addToNumbers.
So as you can see, when you import a built-in module
or your own module, that's exactly the same thing.
And a module is nothing else.
So a very simple module is nothing else.
It just a Python file with some functions in it.
So here import my computations.
And then I do my computations.addToNumbers, which is the function here.
And I can use the function.
If I just want to import the function,
I can do from my computations import
addToNumbers, just like we did with the OS module.
And now I can just use the add to numbers
without providing name of the module before that.
And this way, so if you add many more functions here
and you just want to use the add to numbers,
you are just going to import the add to numbers function.
And one last thing is make sure to provide a meaningful name for your module.
So here as a test, I just put my in front, my computations.
Make sure to use a meaningful name, which clearly states what this module is about.