Very simple Python code that demonstrates how to use Python modules.
.
|-- LICENSE - MIT license file
|-- README.md - This README.md file
|-- module - Python sub-module
| |-- __init__.py - marker for making directory a module
| `-- module_sub.py - contains fun_sub and fun_sub_2
|-- module_root.py - module with fun_root
|-- simple_explicit_import.py - will fail to execute fun_sub_2
| as we don't import it explicitly
|-- simple_import_all.py - import all symbols from module_sub
| and module_root; we don't have to prefix
| symbols with module names
`-- simple_import_module.py - import modules only; we have to prefix
imported symbols with name of the module
eg.: module_root.fun_root()
> git clone https://github.com/mkowsiak/pythonmodules
> cd pythonmodules
> python pythonmodules/simple_explicit_import.py
> python pythonmodules/simple_import_all.py
> python pythonmodules/simple_import_module.py
# you can run all the samples using find
> find . -name "simple_*" -exec python {} \;
Samples are realy basic, and are here to illustrate how to import modules inside your code. Don't expect anything fancy here.