


{"id":161425,"date":"2021-08-18T15:55:19","date_gmt":"2021-08-18T15:55:19","guid":{"rendered":"\/forum\/forums\/topic\/why-wont-my-python-code-stay-connected-when-i-close-re-open-mechanical\/"},"modified":"2021-08-19T06:53:19","modified_gmt":"2021-08-19T06:53:19","slug":"why-wont-my-python-code-stay-connected-when-i-close-re-open-mechanical","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/why-wont-my-python-code-stay-connected-when-i-close-re-open-mechanical\/","title":{"rendered":"Why won&#8217;t my Python code stay &#8220;connected&#8221; when I close\/re-open Mechanical?"},"content":{"rendered":"<div class=\"Item-Body\">\n<div class=\"Message userContent\">\n<p>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 &quot;After Post&quot;. I then right-clicked to &quot;Connect&quot; 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 &quot;Connect&quot; it again for the solver to proceed. The help file indicates that &quot;Connect&quot; only needs to be re-done if the Python code is changed (which it wasn&#039;t, in fact, nothing changed!). Below are images from before closing Mechanical and after re-opening it.<\/p>\n<div class=\"embedExternal embedImage\">\n<div class=\"embedExternal-content\">\n<a class=\"embedImage-link\" href=\"\/forum\/wp-content\/uploads\/forum-uploads\/497\/SDGPMAW4JL83.png\" rel=\"nofollow noopener\" target=\"_blank\"><br \/>\n<img decoding=\"async\" class=\"embedImage-img\" src=\"\/forum\/wp-content\/uploads\/forum-uploads\/497\/SDGPMAW4JL83.png\" alt=\"image.png\" \/><br \/>\n<\/a><\/p>\n","protected":false},"template":"","class_list":["post-161425","topic","type-topic","status-closed","hentry"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_author_ip":[""],"_bbp_old_reply_author_name_id":["Anonymous"],"_bbp_old_is_reply_anonymous_id":["false"],"_btv_view_count":["1028"],"_bbp_likes_count":["0"],"_bbp_subscription":["234414"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["161425"],"_bbp_forum_id":["27791"],"_bbp_engagement":["38715","58821"],"_bbp_voice_count":["2"],"_bbp_reply_count":["2"],"_bbp_last_reply_id":["189421"],"_bbp_last_active_id":["189421"],"_bbp_last_active_time":["2021-08-19 06:53:19"]},"test":"namescfs-energy"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/161425","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/161425\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=161425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}