Next: 4.3 Mapping for Basic Up: 4. OMG IDL to Previous: 4.1 Scoped Names

# 4.2 Mapping for Modules

All IDL modules (top level and nested) are mapped to Python packages. If there are any IDL definitions at the global scope (i.e. outside of a module definition) then the corresponding Python stubs and skeletons are placed in the packages `_GlobalIDL` and `_GlobalIDL_skel` respectively (the names of these packages can be overriden using the ```-globals`'' option on the IDL compiler, see Section ). In order to prevent name clashes with other CORBA applications it is strongly recommended that you do not define any IDL types at the global scope. e.g. Consider the following IDL:

    interface NastyGlobal {};

    module TopLevel {
        interface Foo {};
        module Nested {
            interface Bar {};
        };
    };

The IDL compiler (`fnidl`) will generate the following packages (for more details of the IDL compilation process see Section ):

- `_GlobalIDL` and `_GlobalIDL_skel` containing the stub and skeleton code for the `NastyGlobal` interface.
- `TopLevel` and `TopLevel_skel` containing the stub and skeleton code for the `Foo` interface.
- `TopLevel/Nested` and `TopLevel_skel/Nested_skel` containing the stub and skeleton code for the `Bar` interface.

To use the packages simply import them as normal:

    >>> import _GlobalIDL
    >>> import TopLevel
    >>> import TopLevel.Nested
    >>> _GlobalIDL.NastyGlobal
    <class _GlobalIDL.NastyGlobal at bab40>
    >>> TopLevel.Foo
    <class TopLevel.Foo at 131e10>
    >>> TopLevel.Nested.Bar
    <class TopLevel.Nested.Bar at 9b188>