Scenic Internals

This section of the documentation describes the implementation of Scenic. Much of this information will probably only be useful for people who need to make some change to the language (e.g. adding a new type of distribution). However, the detailed documentation on Scenic’s abstract application domains (in and simulator interfaces (in scenic.simulators) may be of interest to people using those features.

The documentation is organized by the submodules of the main scenic module:


Scenic’s core types and associated support code.

General scenario domains used across simulators.


Support for file formats not specific to particular simulators.


World models and interfaces for particular simulators.


The Scenic compiler and associated support code.

The scenic module itself provides two functions as the top-level interface to Scenic:

scenarioFromFile(path, params={}, model=None, scenario=None, cacheImports=False)[source]

Compile a Scenic file into a Scenario.

  • path (str) – path to a Scenic file

  • params (dict) – global parameters to override

  • model (str) – Scenic module to use as world model

  • scenario (str) – if there are multiple scenarios in the file, which one to use

  • cacheImports (bool) – Whether to cache any imported Scenic modules. The default behavior is to not do this, so that subsequent attempts to import such modules will cause them to be recompiled. If it is safe to cache Scenic modules across multiple compilations, set this argument to True. Then importing a Scenic module will have the same behavior as importing a Python module.


A Scenario object representing the Scenic scenario.

scenarioFromString(string, params={}, model=None, scenario=None, filename='<string>', cacheImports=False)[source]

Compile a string of Scenic code into a Scenario.

The optional filename is used for error messages.