How to import all modules in __init__.py in python?
I have a directory that contains several .py files/modules. In that directory, I put __init__.py within with an intent to make it a package. What I would like to have is, when I import the directory, I would access all the methods from individual modules without specifying each module name inside __init__.py. This means, when I would add a new module, __init__.py would pick it up and I am free off manual update of that module name inside of __init__.py. Here is an example to show what I want: /my_package/ module1.py module2.py .......... .......... moduleN.py Now, within module1.py, I have def
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.