1 00:00:00,000 --> 00:00:09,840 In this video, you'll learn about modules and packages. 2 00:00:09,840 --> 00:00:12,680 A module is a file that contains code. 3 00:00:12,680 --> 00:00:16,680 So here we see a module with the name greeting.py. 4 00:00:16,680 --> 00:00:21,760 It defines a function sayHello, and it uses the sayHello name. 5 00:00:21,760 --> 00:00:25,760 And it returns hello followed by a name, 6 00:00:25,760 --> 00:00:28,480 where the name is a variable that will be used. 7 00:00:28,480 --> 00:00:30,520 And you can use it in another file, 8 00:00:30,520 --> 00:00:33,599 as in import greeting, which will import the module. 9 00:00:33,599 --> 00:00:36,480 And then you use print greeting, which 10 00:00:36,480 --> 00:00:39,520 is the name of the module, dot sayHello. 11 00:00:39,520 --> 00:00:41,279 Anna, for instance, which is the name 12 00:00:41,279 --> 00:00:43,919 that you want to print then. 13 00:00:43,919 --> 00:00:45,240 Now we have a package. 14 00:00:45,240 --> 00:00:47,000 A package is a complete directory 15 00:00:47,000 --> 00:00:53,759 that contains modules and an __init__.py file. 16 00:00:53,759 --> 00:00:55,480 Functions from the modules in a package 17 00:00:55,480 --> 00:00:59,799 can be imported in code using from package.module one 18 00:00:59,799 --> 00:01:02,240 import my function. 19 00:01:02,240 --> 00:01:04,440 And using packages makes it easier 20 00:01:04,440 --> 00:01:06,839 to implement standardization. 21 00:01:06,839 --> 00:01:08,720 Packages are also one of the reasons 22 00:01:08,720 --> 00:01:11,959 behind the success of Python, because it is what 23 00:01:11,959 --> 00:01:15,199 makes Python easily extensible.