So far all the programs we've been writing have been in single files. I'm guessing you can imagine, that as your programs get bigger this is going to be a problem. Right. You want to be able to break things up into different pieces. Python allows you to do this with the concept of modules. In fact, each python file is its own module. And, you can import other modules into the file you're currently running. Right. So, this allows us to break our program into pieces and then use the other pieces as we'd like. This has a lot of advantages not the least of which, Python comes with some built in modules allowing us to import those built in modules and use the functionality that has been provided with these default libraries. This, saves us a lot of time and effort. So, let's take a look at how all this works. This simple program makes use of modules. It imports other modules that it can then use within itself. Now, first look how do we import the module look up here in the top. I have this line import math. Right. Import, is the python directive saying, I want to import another module into this one. Math is the name of that module. OK. So this is all we have to do. Now, you notice here I can have a little bit more complicated import statement. Maybe, I don't like the name of the module and I want to use a different name within this module for that module. OK. So, I import examples three under bar module as example. Right. The actual name of the module is examples three under bar module. But, I don't want to call it that inside of this file rather I want to call it example. So, I can use the as keyword here to change this name only inside this file. OK. Right. And, that's how I actually import these modules. So, how do we actually use these modules? Well, there are python files with Python programs in them just like any other Python program. So, they can have things like constants and functions inside of them. Right. So, let's take the math module as an example and take a look. The math module has some constants in it including pi and e.Right. And so, how do I get at those? Well, inside of this program since I've imported math, I get at things inside of math by first writing math. So, I have the name of the module math dot and then things inside the module. So, math.pi refers to the constant pi inside of the math module. Math.e refers to the constant e inside of the math module. Right. So, let's print those out and see what happens. OK. So, we get those constants. Hopefully, you recognize pi as 3.14159 and e as 2.71828 and so on. Right. So, that's how we can access these constants. Modules can also have other code in them so like functions. All right. So, it's call some math functions, math square root, trunc and sin. Right. Square root does the obvious thing. Trunc basically takes a floating point number and truncates it. Gets rid of the fractional part and sin well that's the trigonometric function sin. So, we can call these functions. Right. And, get some results. The square root of 25. Alright. It was 5. Math module works. This saves us from having to write these functions ourselves. We can just import this math module which is part of Python. You can actually go look at the code sculptor documentation or the Python documentation. And, see all the different functions that it provides. OK. But, you might write your own modules. And, in that case you have to go look at the code and see what's going on. Or ideally you should actually document that as well. But, Python also provides us a nice function here called Dir. OK. Which actually, stands for you know directory give me information about this module. And so, if I called Dir with a module, it's going to tell me all the things that are inside of that module. OK. So, we run this. We can see that inside of math, it has these things with these under bars in it. I'm going to ignore that for a second. OK. We got acos, acosh, asin, asinh and so on. We've got a whole bunch of trigonometric functions. There's 'e', 'factorial'. Alright. We have a whole bunch of different functions. Right. Now, that example module that's something that I wrote example's 3_module that were renaming a sample. So, I do an example here. We've got a whole bunch of things here. And those under bar things. And, then there's this one element message. I wonder what that is. So, let's print that out. And, let me also return to one of those double under bar things. Which is, name. OK. That is actually the name of the module. So, if I print out math dot under bar under bar name under bar under bar. I would expect it to say math. OK. Because, that's the name of that module. Right. By example, dot under bar under bar name under bar under bar. Well, that sort of more complicated. What exactly is the name of that module? Let's find out. OK. Run. Alright. So, we find out the message inside of our example module is Python is fun. Well, of course it is. OK. The name of the math module is math. The name of the example module is not what I renamed it to here. OK. Its actual name it's examples 3_module. Python programs generally don't stand on their own. So, pretty much every program you will write is very likely to import at least one module. Fortunately, this is easy to do. All we have to do is say import and then the module name. Then, when we want to use the contents in the module, we simply say the module name dot and then the name of the function or consonant or whatever it is that we'd like to access. This is a pretty easy to do. And trust me, before long this will become old hat. You'll be very comfortable with it. Now, I do want to caution you about the use of the keyword as to modify the modules name. Please don't do this gratuitously and certainly don't do it with Python built in modules. Right. Everybody knows what the math module is. So, when they see math dot they know exactly what you're doing. But, if you had changed it to 'm', then it becomes very unclear about what exactly is happening. It is appropriate in some cases, if you have a long and unwieldy module name perhaps it will make your program cleared to actually use a shorter name. But, make sure that you pick both a clear and descriptive name. And, if you can't come up with one just use the longer name on it's own. Right. This will help to improve the clarity of your programs not degrade it.