- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do I import all the submodules of a Python namespace package?
The "from module import *" statement is used to import all submodules from a Python package/module. For example, if you want to import all modules from your module(say nyModule) and do not want to prefix "myModule." while calling them, you can do it as follows:
>>> from myModule import *
Note that for any reasonable large set of code, if you import * you will likely be cementing it into the module, unable to be removed. This is because it is difficult to determine what items used in the code are coming from 'module', making it easy to get to the point where you think you don't use the import any more but it's extremely difficult to be sure. It basically clutters the namespace and leaves you with lesser options to name things in your module.
- Related Articles
- How do I create a namespace package in Python?
- How to import everything from a python namespace / package?
- How do I create a Python namespace?
- Do I need to import the Java.lang package anytime during running a program?
- How do I declare a namespace in JavaScript?
- How to import Pandas package?
- Can I import same package twice? Will JVM load the package twice at runtime?
- Why we do not import a package while we use any string function?
- How do I write package names in Java?
- How do I list all files of a directory in Python?
- How I can dynamically import Python module?
- How can I import modules for a Python Azure Function?
- Difference between import and package in Java?
- Can we define a package after the import statement in Java?
- How do I get a list of all instances of a given class in Python?

Advertisements