Skip to content

Utilities

Loading modules module

Import Jupyter Notebook or Python. It's normally used in chaining

Import/Execute Jupyter Notebook

API zapy.utilities.module.load_ipynb
function

load_ipynb( module_path, variables = None )

Attributes
module_path : str | Path
Path to the .ipynb file
variables : dict = None
Dictionary containing variables to load into ipynb.

Use the load_ipynb to execute a .ipynb file. The file should only contain python code and not special expressions from Jupyter.

For example:

from zapy.utils import module
rel_path = Path('tests/assets')
# invoke jupyter notebook
chain = await module.load_ipynb(rel_path / 'chain_import.ipynb', variables={
    'rel_path': rel_path
})
# access a variable
print(chain.out_response)

Import/Execute Python

API zapy.utilities.module.load_module
function

load_module( module_path )*

Attributes
module_path : str | Path
Path to the .py file or python directory

This is normally done inside a .ipynb file to import a python module.

from zapy.utils import module

if __name__ == '__main__':
    setup_store = module.load_module('./setup')