Install with pip:

$ pip install rnginline

You can use it from Python like this:

>>> import rnginline
>>> rnginline.inline('my-nested-schema-root.rng')
<lxml.etree.RelaxNG object at ...>

You can load a multi-file schema from a Python package’s data like this:

>>> import rnginline
>>> from rnginline.urlhandlers import pydata
>>> url = pydata.makeurl('rnginline.test',
...                      'data/testcases/external-ref-1/schema.rng')
>>> url
>>> rnginline.inline(url)
<lxml.etree.RelaxNG object at ...>

You can use it from the command line like this:

$ rnginline my-nested-schema-root.rng flattened-output.rng

See Using rnginline From the Command Line or Using rnginline From Python for more details.