8.14. import Statement

Synopsis: import "name_space";

The import statement allows you to import another namespace (module) into the one you are just running in. Then you can access the global functions and variables of that namespace using the double-colon.

Namespaces, to be imported, are looked up in the /usr/share/YaST2/modules/ directory.

{
    import "Hostname";
    import "IP";
    
    // writes: Check FQDN: true
    y2milestone("Check FQDN: %1", Hostname::Check("www.example.com"));

    // writes: Check IP4: false
    y2milestone("Check IP: %1", IP::Check4("192.168.0.356"));
    
}

This is often used for clients using some global API of modules but also for modules using global API of another ones. Please, be careful on creating cross-dependencies when creating an RPM package from sources.