conditional_import
FunctionPrivateSource
module: ModuleType = conditional_import(
name: str
)
Import the module if it exists. Otherwise, return a [`ModulePlaceholder`](./ModulePlaceholder.mdx).
Arguments
Requires
Argument | Type | Required | |
---|---|---|---|
name | str | The name of the module to be imported. |
Returns
Argument | Type | |
---|---|---|
module | ModuleType | If the module exists, this value is the imported module. Otherwise, it is a ModulePlaceholder . |