资 源 简 介
Introduction
When you have a large package that contains nested submodules this allows the nested submodules to refer to one another without having to pull in or know much about or explicitly import entire top-level tree. In contrast to Python"s relative imports, we don"t care if a file is invoked as a main program or as part of a module in the collection.
Synopsis
```
from importrelative import importrelative, get_srcdir
# Below "trepan" is my top-level namespace
# "io" is the directory this file is in.
Mbase = import_relative("base", ".", "trepan") # Adds trepan.io.base
# The following adds trepan.lib.bytecode
Mbytecode = import_relative("bytecode", "..lib", "trepan")
class MyClass(Mbase.InputBase): # Use name from Mbase
...
NOTE; if your module name is "io" import like this:
Mio = import_relative("trepan.io", "..")
# rather than
Mio = import_relative("io", "..trepan")
like os.pat