import()

Imports the given extension module. Returns an object that can be used to call the methods of the module. Here's an example for a hypothetical testmod module.

Signature

# Imports the given extension module
module import(
  str module_name,     # Name of the module to import

  # Keyword arguments:
  disabler : bool            # Returns a disabler object when not found.
  required : bool | feature  # When set to `false`, Meson will proceed with the build even if the module is not found
)

Example

tmod = import('testmod')
tmod.do_something()

Arguments

The function import() accepts the following positional arguments:

Name Type Description Tags
module_name str

Name of the module to import.

Finally, import() accepts the following keyword arguments:

Name Type Description Tags
disabler bool

Returns a disabler object when not found.

(since 0.59.0)

required bool | feature

When set to false, Meson will proceed with the build even if the module is not found. When set to a feature option, the feature will control if it is searched and whether to fail if not found.

(since 0.59.0)

default = true

The results of the search are