Special scripts

startup.py

If the file startup.py exists in the current CityEngine workspace root, it will be executed automatically during CityEngine startup. Typical use cases for the startup script is running automated tasks with CityEninge.

In the example below, a Python script defining an automation job is automatically executed after startup.

if __name__ == '__startup__':
    sys.path.append(ce.toFSPath("automationProject/scripts"))
    import automationJob
    automationJob.run()
Note:

Make sure startup.py is well formed and does not contain errors. An incorrect startup.py can prevent the main scripting module from being parsed, and can prevent correct execution of the scripting interface.

scripting.py

If the file scripting.py exists in the current CityEngine workspace root, its content will be appended to the end of the main CityEngine scripting module with the same name. The from scripting import * command is automatically executed when a new Python console is opened and added to each new Python file created in within CityEngine. Typical use cases include adding your scripting directory to the system path, or loading your custom modules to the scripting environment.

Note:

CityEngine needs to be restarted in order to load changes in the file scripting.py. Make sure scripting.py is well formed and does not contain errors. An incorrect scripting.py can prevent the main scripting module from being parsed, and can prevent correct execution of the scripting interface.

See also


In this topic
  1. startup.py
  2. scripting.py