Hi and welcome to a new section in this course in this section.
I want to talk about Michael Python module's Michael Python module's just like a regular python.
Modules are files that contain functions and code that you can import and use in your own scripts.
Very often we tend to use the word libraries instead of modules, but those two words are equivalent.
You they can use either one and understand what you're talking about myself.
I often use the word libraries instead of modules.
So just wanted to give you a quick example of what a module can do for your programming and for your
productivity.
And in the next few lectures in this section, I'm going to talk about the modules that you find integrated
into my python.
So let's call those built in modules and then there are the community modules.
So these are modules that are contributed by people that use micro python or python.
And what we're going to show you how to install such community modules.
This script is a script that I'm demonstrating in a later lecture, and it's showing how to use a two
by 16 LCD screen with your E.S.P 32.
Now, if you notice here in line thirty seven, I am importing an external module and the name of this
module is E.S.P eight two six six.
And it going see underscore L'Occitane now using the Keywood as.
To nominate a different name by which I'm going to reference the contents of this module in my script
so you can sit down here, for example, in line 44, where I am creating a object out of this eye to
see LCD class that I'm using the nominated names specified after the keyword.
So you can do things like that in order to shorten perhaps a name of a very long named module.
Now, back to the module itself.
The name that I'm using here to input the module is simply the name of the file for that same module.
So if you look here in my micro python device file listing, you'll see that there is a file with the
exact same name, except that it also has the dot p y extension and have opened it up right here.
And you can have a look at it.
So this is the.
Module that I am importing and you can see the code in it and you can see what it does.
Now, the other interesting thing to notice here is that this module actually has one more dependency.
So you can see in line number four, it depends on another module.
That is also an external module that I had to download from its source called LCD API.
And you can get from this the actual file name of the file that contains this module is LCD and the
API dot p y, which is right here.
But this is a fairly large module, don't click on and then you can have a look inside, you can see
that it's called one class here called the LCD API, and it's got a bunch of functions in it.
And so therefore it's quite large.
And for that reason, I'm using the key word import to import a specific class instead of importing
the whole lot.
Now, imagine that this file of this module contained to multiple classes.
So instead of just the single one that this one contains.
Imagine that he had multiple classes.
By using this type of notation, you can narrow down the class or classes that you want to import as
opposed to importing the entire module, which is something very useful when you're working with devices
that have limited capacity.
So all this is stored in RAM.
Of course, when you import and instantiate a class and you have an object to work with or that is in
RAM.
So by being selective about the components of a module that you want to import, then you can preserve
the resources of your microcontroller unit in the same file here.
Just to continue this for one more step.
You can see that we are also importing modules from machine and from time.
And these these modules are built into micro python, which means that we don't have to install the
files that contain those modules like we did with the DSP.
So we can notice here that there is no file called machine PCI or time dot behind this, because these
two modules are built in two micro parties.
They come with the language and they're part of the interpreter.
So that's just the quick introduction about modules.
We can understand the concept behind them and why they are useful.
So that means we can go ahead into the next couple of lectures where I can talk more about built in
modules, show you a few things about them, including where to find the documentation, because there
are a lot of them.
There's no way that I'd be able to cover them in this course.
But I'll give you the source of all the information that you need.
And then in the lecture after that, I'll show you how to search the community on the Internet in order
to look and find micro python modules that would be useful for your project for go into.