Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

Why won’t my Python code stay “connected” when I close/re-open Mechanical?

    • nicolicfs
      Subscriber

      I inserted some Python code in my Solution. I want the code to execute after the model is solved, so I set the Target Callback to "After Post". I then right-clicked to "Connect" the code. When I subsequently solve the model, the code executes flawlessly. However, if I close Mechanical and re-open it, the code is not connected, so I must "Connect" it again for the solver to proceed. The help file indicates that "Connect" only needs to be re-done if the Python code is changed (which it wasn't, in fact, nothing changed!). Below are images from before closing Mechanical and after re-opening it.

    • nicolicfs
      Subscriber
      I found the solution to my problem. Seems this is by design, but there is a workaround:
      Resuming Databases with Python Code Objects (ansys.com)
    • ErKo
      Ansys Employee

      Many thanks for posting the solution to your question.

      All the best

      Erik
Viewing 2 reply threads
  • The topic ‘Why won’t my Python code stay “connected” when I close/re-open Mechanical?’ is closed to new replies.
[bingo_chatbox]