

{"id":9360,"date":"2018-02-27T10:47:32","date_gmt":"2018-02-27T10:47:32","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=9360"},"modified":"2026-04-24T15:37:28","modified_gmt":"2026-04-24T10:07:28","slug":"python-modules-vs-packages","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/","title":{"rendered":"Python Modules vs Packages | Differences Between Python Modules and Packages"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:149,&quot;href&quot;:&quot;https:\\\/\\\/www.python.org&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251206090101\\\/https:\\\/\\\/www.python.org\\\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-06 12:20:59&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-09 12:44:48&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-12 13:49:48&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-15 14:13:48&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-18 15:26:07&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-21 17:05:18&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-24 19:33:20&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-28 02:44:18&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-31 04:43:13&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-03 07:01:16&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-06 07:15:14&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-09 07:16:21&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-12 10:01:16&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-15 10:07:06&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-18 10:11:43&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-21 10:20:21&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-24 10:47:21&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-27 10:58:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-30 10:59:29&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-02 12:28:37&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-05 13:05:41&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-08 15:11:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-11 15:46:29&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-14 17:21:34&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-17 18:37:27&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-20 18:52:05&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-23 19:52:29&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-27 01:02:50&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-02 03:50:52&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-05 05:18:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-08 06:18:52&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-11 07:24:15&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-14 08:33:37&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-17 08:58:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-20 12:26:41&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-23 14:32:34&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-26 16:21:46&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-29 17:22:50&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-01 18:18:54&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-04 18:27:04&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-08 02:33:55&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-11 04:53:57&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-14 06:48:30&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-17 07:17:55&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-20 07:32:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-23 09:34:41&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-26 10:13:17&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-29 10:35:31&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-02 11:50:34&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-05 12:07:03&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-08 13:08:24&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-11 14:46:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-14 21:24:09&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-18 03:08:37&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-21 06:27:39&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-24 07:06:36&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-27 07:30:50&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-30 08:47:47&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-02 09:37:18&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-05 09:43:29&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-08 10:40:15&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-11 10:49:02&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-11 10:49:02&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<p>In our article on Python Modules vs Packages, we discussed what they are and saw how to create our own. We also saw where they are located in our file system. But throughout the article, we saw a lot of similarities to modules. Hence, we dedicate this article to the differences between Python Modules and Packages.<\/p>\n<div id=\"attachment_9481\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Modules-vs-Packages-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-9481\" class=\"wp-image-9481 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Modules-vs-Packages-01.jpg\" alt=\"Python Modules vs Packages\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Modules-vs-Packages-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Modules-vs-Packages-01-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Modules-vs-Packages-01-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Modules-vs-Packages-01-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Modules-vs-Packages-01-1024x536.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-9481\" class=\"wp-caption-text\">Python Modules vs Packages<\/p><\/div>\n<h3>What are Python Modules?<\/h3>\n<p>A module is a Python file containing Python statements and definitions. For example, a file evenodd.py is a module, and we call it \u2018evenodd\u2019. We put similar code together in one module. This helps us modularize our code and make it much easier to deal with. And not only that, a module grants us reusability. With a module, we don\u2019t need to write the same code again for a new project that we take up.<\/p>\n<p>In our previous article, we created a module evenodd in package two. This is what evenodd.py holds:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def check():\r\n         a=int(input('Enter a number'))\r\n         if a%2==0: print(\"Even\")\r\n         else: print(\"Odd\")<\/pre>\n<h4>a. How to Import a Python Module?<\/h4>\n<p>So, as you can see, a module simply contains Python code. Consequently, we can import it, like a package.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; import one.two.evenodd\r\n&gt;&gt;&gt;<\/pre>\n<p>To call the function check(), we do the following:<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; from one.two.evenodd import check\r\n&gt;&gt;&gt; check()<\/pre>\n<p>Enter a number7<br \/>\nOdd<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt;<\/pre>\n<p>Another example would be the constants \u2018pi\u2019 and \u2018e\u2019 from the \u2018math\u2019 module.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; import math\r\n&gt;&gt;&gt; from math import pi\r\n&gt;&gt;&gt; math.pi<\/pre>\n<p>3.141592653589793<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; math.e<\/pre>\n<p>2.718281828459045<br \/>\nWe can also import using an alias or using the from..import statement, like we do with packages. To import everything from a module, we do the following:<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; from math import *\r\n&gt;&gt;&gt; e<\/pre>\n<p>2.718281828459045<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; pi<\/pre>\n<p>3.141592653589793<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt;<\/pre>\n<p>Let\u2019s update evenodd.py to have two functions- check and evenodd.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def check():\r\n        a=int(input('Enter a number'))\r\n        if a%2==0: print(\"Even\")\r\n        else: print(\"Odd\")\r\ndef add(a,b):\r\n        return a+b<\/pre>\n<p>Now, if we want to import all functions from the module evenodd, we can just use the wildcard *:<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; from one.two.evenodd import *\r\n&gt;&gt;&gt; check()<\/pre>\n<p>Enter a number0<br \/>\nEven<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; add(3,4)<\/pre>\n<p>7<\/p>\n<h4>b. Search Path using Python module<\/h4>\n<p>When we import a module, the interpreter first looks in the current <a href=\"https:\/\/data-flair.training\/blogs\/python-directory\/\">directory<\/a>. Then, it looks into PYTHONPATH, an environment variable with a list of directories. Finally, it looks into the installation-dependent default directory.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; import sys\r\n&gt;&gt;&gt; for i in sys.path:\r\n      print(i)<\/pre>\n<p>C:\\Users\\lifei\\AppData\\Local\\Programs\\Python\\Python36-32\\Lib\\idlelib<\/p>\n<p>C:\\Users\\lifei\\AppData\\Local\\Programs\\Python\\Python36-32\\python36.zip<\/p>\n<p>C:\\Users\\lifei\\AppData\\Local\\Programs\\Python\\Python36-32\\DLLs<\/p>\n<p>C:\\Users\\lifei\\AppData\\Local\\Programs\\Python\\Python36-32\\lib<\/p>\n<p>C:\\Users\\lifei\\AppData\\Local\\Programs\\Python\\Python36-32<\/p>\n<p>C:\\Users\\lifei\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\site-packages<\/p>\n<h4>c. Reloading a Python Module<\/h4>\n<p>A module is imported only once. This is for efficiency purposes. Let\u2019s add this code to evenodd.py:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">print(\"Loading evenodd\")\r\nnum=7<\/pre>\n<p>Now, let\u2019s restart the shell and import evenodd thrice.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; import one.two.evenodd<\/pre>\n<p>Loading evenodd<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; import one.two.evenodd\r\n&gt;&gt;&gt; import one.two.evenodd<\/pre>\n<p>See? It imported it only once. Because of this, Python gives us a function to let us reload the module when we want to. This is in the module \u2018imp\u2019.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; import imp\r\n&gt;&gt;&gt; imp.reload(one.two.evenodd)<\/pre>\n<p>Loading evenodd<br \/>\n&lt;module &#8216;one.two.evenodd&#8217; from &#8216;C:\\\\Users\\\\lifei\\\\AppData\\\\Local\\\\Programs\\\\Python\\\\Python36-32\\\\lib\\\\site-packages\\\\one\\\\two\\\\evenodd.py&#8217;&gt;<\/p>\n<h4>d. dir() in Python<\/h4>\n<p>Finally, dir() will let us check the components of a module.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; dir(one.two.evenodd)<\/pre>\n<p>[&#8216;__builtins__&#8217;, &#8216;__cached__&#8217;, &#8216;__doc__&#8217;, &#8216;__file__&#8217;, &#8216;__loader__&#8217;, &#8216;__name__&#8217;, &#8216;__package__&#8217;, &#8216;__spec__&#8217;, &#8216;add&#8217;, &#8216;check&#8217; , &#8216;num&#8217;]<br \/>\nWe saw this function when we talked about the <a href=\"https:\/\/data-flair.training\/blogs\/python-built-in-functions\/\">Built-in Functions in Python<\/a>.<\/p>\n<h3>What are Python Packages?<\/h3>\n<p>A package, in essence, is like a directory holding subpackages and modules. While we can create our own packages, we can also use one from the Python Package Index (PyPI) to use for our projects.<\/p>\n<p><strong>Benefits of using packages in Python:<\/strong><\/p>\n<ul>\n<li><strong>Code reusability:<\/strong> They help in combining the functions that can easily be shared and can be imported into different projects.<\/li>\n<li><strong>Namespace management:<\/strong> Developers prevent variable and module names from being the same by grouping them under a unique package name.<\/li>\n<li><strong>Scalability:<\/strong> A logically grouped component of a large database can make it easier to show directions and maintain.<\/li>\n<\/ul>\n<h3>Differences Between Python Modules and Packages<\/h3>\n<p>So, now that we\u2019ve revised both modules and packages, let\u2019s see how they differ:<\/p>\n<ol>\n<li>A module is a file containing Python code. A package, however, is like a directory that holds sub-packages and modules.<\/li>\n<li>A package must hold the file __init__.py. This does not apply to modules.<\/li>\n<li>To import everything from a module, we use the wildcard *. But this does not work with packages.<\/li>\n<\/ol>\n<p>This was all about the article on Python Modules vs Packages<\/p>\n<h3>Conclusion<\/h3>\n<p>Now that we know what subtle differences exist between a module and a package, let\u2019s take up a challenge and take up a project of our own. Let\u2019s do this to test our package skills? Okay.<\/p>\n<p>Furthermore, if you have any queries, feel free to approach us!<\/p>\n<p><a href=\"https:\/\/www.python.org\/\"><strong>For reference<\/strong><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our article on Python Modules vs Packages, we discussed what they are and saw how to create our own. We also saw where they are located in our file system. But throughout the&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":36393,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[6614,16503,10687,10688,10754,11508,12669],"class_list":["post-9360","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-import-python-module","tag-module-vs-packages","tag-python-modules","tag-python-modules-vs-packages","tag-python-packages","tag-reloading-a-module","tag-search-path-in-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Modules vs Packages | Differences Between Python Modules and Packages - DataFlair<\/title>\n<meta name=\"description\" content=\"Python Modules vs Packages: Learn Python Modules Introduction, Importing a Python module,Reloading a Module,Differences Between Python Modules and Packages\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Modules vs Packages | Differences Between Python Modules and Packages - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Python Modules vs Packages: Learn Python Modules Introduction, Importing a Python module,Reloading a Module,Differences Between Python Modules and Packages\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-27T10:47:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-24T10:07:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Modules-vs-Packages-01-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Modules vs Packages | Differences Between Python Modules and Packages - DataFlair","description":"Python Modules vs Packages: Learn Python Modules Introduction, Importing a Python module,Reloading a Module,Differences Between Python Modules and Packages","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/","og_locale":"en_US","og_type":"article","og_title":"Python Modules vs Packages | Differences Between Python Modules and Packages - DataFlair","og_description":"Python Modules vs Packages: Learn Python Modules Introduction, Importing a Python module,Reloading a Module,Differences Between Python Modules and Packages","og_url":"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-02-27T10:47:32+00:00","article_modified_time":"2026-04-24T10:07:28+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Modules-vs-Packages-01-1.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Python Modules vs Packages | Differences Between Python Modules and Packages","datePublished":"2018-02-27T10:47:32+00:00","dateModified":"2026-04-24T10:07:28+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/"},"wordCount":760,"commentCount":8,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Modules-vs-Packages-01-1.jpg","keywords":["Import Python module","Module vs packages","Python Modules","Python Modules vs Packages","Python Packages","REloading a module","Search Path in Python"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/","url":"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/","name":"Python Modules vs Packages | Differences Between Python Modules and Packages - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Modules-vs-Packages-01-1.jpg","datePublished":"2018-02-27T10:47:32+00:00","dateModified":"2026-04-24T10:07:28+00:00","description":"Python Modules vs Packages: Learn Python Modules Introduction, Importing a Python module,Reloading a Module,Differences Between Python Modules and Packages","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Modules-vs-Packages-01-1.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Modules-vs-Packages-01-1.jpg","width":1200,"height":628,"caption":"Differences Between Python Modules and Packages"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Python Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Python Modules vs Packages | Differences Between Python Modules and Packages"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/9360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=9360"}],"version-history":[{"count":7,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/9360\/revisions"}],"predecessor-version":[{"id":147846,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/9360\/revisions\/147846"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/36393"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=9360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=9360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=9360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}