21.3. Resuming Databases with Python Code Objects

When you open a saved analysis that includes Python Code objects, by default, the objects display in an under-defined state. This is done so that callbacks are not automatically connected to the objects.

To change this default setting, go to the Workbench project page and open the Options dialog by selecting Tools > Options. Highlight the Mechanical option and then select the checkbox for the Connect/Run Python Code Objects when Mechanical is Launched property.


Recommendation:  For security purposes, the application does not automatically connect Python Code (object) callbacks when you launch Mechanical. You must first activate the Connect/Run Python Code Objects when Mechanical is Launched preference contained in the Mechanical category of the Workbench Options dialog (Tools > Options > Mechanical).

Python code callbacks can execute code on a host system with the same privileges as Mechanical. Therefore, when you open a project that includes a Python Code object, and that object contains unreliable code, your system could become exposed to external threats (system scans, data deletion, installation of undesired software, etc.).

You can activate the above preference to automatically connect Python Code objects when opening projects, however, Ansys recommends that you keep this option unchecked if you receive and run projects from users other than yourself.



Important:  Also note that if the Python Code object includes scripts related to Design Points, you must activate the above option.