Skip to main content

get_root_path

Find the root path of a package, or the path that contains a module. If it cannot be found, returns the current working directory.

def get_root_path(
import_name: str
) - > str

Find the root path of a package, or the path that contains a module. If it cannot be found, returns the current working directory.

Parameters

NameTypeDescription
import_namestrThe name of the package or module for which to find the root path.

Returns

TypeDescription
strThe absolute path to the root directory of the package or module, or the current working directory if not found.