From 581d4999babb118782f74eb75346d24c2d15ae4b Mon Sep 17 00:00:00 2001 From: radinpirouz Date: Wed, 4 Feb 2026 01:30:00 +0330 Subject: [PATCH] added pkg modules ( not cleaned ) --- Docs/Basic/06-pkg-modules.md | 61 ++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Docs/Basic/06-pkg-modules.md diff --git a/Docs/Basic/06-pkg-modules.md b/Docs/Basic/06-pkg-modules.md new file mode 100644 index 0000000..d7806cd --- /dev/null +++ b/Docs/Basic/06-pkg-modules.md @@ -0,0 +1,61 @@ +```python +import emoji +print(emoji.emojize("abbas is :red_heart:")) +``` + +```python +from emoji import emojize +print(emojize("abbas is :red_heart:")) +``` + +--- + +create modules + +hi.py +```python +def hi(): + print("Hi :)") +``` +main.py +```python +import hi +hi.hi() +``` + + +--- + +create package + +honor/hi.py +```python +def hello(): + print("Hi :)") +``` +honor/__init__.py +```python +``` + +Can Be Empty But Must Be Exist + +main.py +```python +from honor import hi +hi.hello() +``` +or +main.py +```python +from honor.hi import hello +hello() +``` + + +__name__ conecpt : + +```python +print(__name__) +``` + +if we run dirctly for example python3 abbas.py the output is __main__ but if import it that is diffrent \ No newline at end of file