Friday, May 26, 2023

Create User Define Package in Python

 

 

Step1: Create one Folder Myapp                         

 

Step2: Inside Myapp create Sub-Folder Mypackage

Step3: Create an empty   __init__.py   file inside Mypackage Sub-Folder

 

Step4: Create two modules Message.py and Mathematics.py inside Mypackage Sub-Folde


follow the following steps:



 1)Write the following code in Message.py module


                                
                    


                


2)write the following code inside the Mathematics.py Module


             


     



Step5: Create p1.py file Myapp folder and write following code:


                          



 

Step6:Used to choose specific functions from modules in the package folder and make them available import

Modify __init__.py as below:





Step7: Create test.py in the Myapp Folder and write following code: