When I say import numpy as np
, I can access all the modules and submodules in numpy from np. I do not have to say np.matrixlib.matrix
. What is this feature called? How do I implement this in my package.
If one want's that submodules are available in the main module, they have to be imported in __init__.py
.
See for example numpy/__init__.py
:
from .matrixlib import *
imports everything from numpy.matrixlib
into numpy
.