Skip to main content

prepare_import

Given a filename this will try to calculate the python path, add it to the search path and return the actual module name that is expected.

def prepare_import(
path: str
) - > str

Given a filename this will try to calculate the python path, add it to the search path and return the actual module name that is expected.

Parameters

NameTypeDescription
pathstrThe file path to a Python module or package.

Returns

TypeDescription
strThe calculated Python module name suitable for import.