Skip to content
Tyler edited this page May 17, 2023 · 3 revisions
  1. Before you can start using Pypeline, you’ll need to add the library to your AnyLogic environment. Place the Pypeline jar file in a location where it won’t be moved from (or accidently deleted).
  2. Inside AnyLogic, from within the Palette panel, select the “+” button on the bottom left. Then select “Manage libraries…”, then “Add”, then select the Pypeline jar file. Confirm all open windows.
    • Further details for adding a custom AnyLogic library are described in the AnyLogic help article, "Managing Libraries".
  3. Afterwards, you should see a new tab in your AnyLogic palette, as shown below:

Object in palette

  1. Drag the “Py Communicator” object (henceforth referred to as “the Communicator”) into an existing model. There are some options to configure (see the screenshot below):

Properties overview

  • Load last working configuration (default: false)

    • Selecting this option will override the remainder of the settings, using the last configuration that successfully connected to Python
    • This is useful when you have one version of Python that you always use, without having to reselect the options for it (as it works across all models)
    • If you have not previously run Pypeline, it will fall back to the default options
  • Command to call Python (default: python)

    • This informs the library which command to use to call Python; for more information on how this works, see the page on connection details.
    • Selecting “(other)” allows you to specify a custom alias/command to call Python; for example, see the screenshot below:

    Properties 'other' command

    • Selecting the “(path)” option allows you to specify the full path to a Python executable (Windows users: backslashes will need to be escaped)
  • Throw error on failed attempt (default: true)

    • This will cause a runtime error to be thrown if any of your Python commands fail
  1. Use the available functions (described in the functions page) to execute Python code.
  2. Run your model! If you click on the Communicator object to view its inspection window, the version and executable path of the Python that is currently running will be listed. An example is shown in the image below:

Running example

Note: If an error occurs or you don't see similar text in the inspection window, consult the troubleshooting page.