What is "Module" ?
Module is nothing but a "Python File" . Now , how to identify which one is the python file it's a question which people often think of themselves. A python file is that file which has created with (.py) extension. In simple words it contains variables , functions and classes.
What is "Package" ?
Package is collection or group of "Modules" .
What is "Library" ?
Library is a group of "Packages"
What is "Import" ?
"Import" is a pre-defined keyword in python.
How to "Import"?
STEP 1 - Create a folder with any name you want.
STEP 2 - Now open that folder with any "Code Editor" you prefer. In my case I am using "Visual Studio Code". ๐๐
STEP 3 - Then , create a file with (.py) extension . ๐๐
STEP 4 - Create another file where you want to import stuff but these both files must be exist in same folder. ๐๐
STEP 5 - As you know that I have now two files which are A1 & A2 . Now , let's create a variable in A1 let's see how I can import it. ๐๐
STEP 6 - To import make sure that you have write "Import" keyword and the file name which you want to "Import' in that particular file where you actual want to use any function , class or variable. Like here in my case I want to use "x" which is present in A1 and I want to use it in A2. ๐๐
STEP 7 - Now A1 is "imported" let's try to print "x". ๐๐
STEP 8 - Ohh! ๐ฒ There is an error while printing but why? Have I made any mistake NO! ๐ค Why I am unable to access the element of A1 ??
๐ I am facing this issue because I should write like this "print(A1.x)" this to print element of A1. ๐๐
STEP 9 - Now Everything is working fine...........๐๐