


{"id":453284,"date":"2026-02-25T16:40:14","date_gmt":"2026-02-25T16:40:14","guid":{"rendered":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/discovery-scripting-how-to-save-discovery-scripting-functions-in-modules\/"},"modified":"2026-02-25T16:40:14","modified_gmt":"2026-02-25T16:40:14","slug":"discovery-scripting-how-to-save-discovery-scripting-functions-in-modules","status":"publish","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/discovery-scripting-how-to-save-discovery-scripting-functions-in-modules\/","title":{"rendered":"Discovery Scripting: how to save Discovery Scripting functions in modules?"},"content":{"rendered":"<p>&lt;p&gt;I am working on a series of Discovery scripting functions. Right now we are including those in every *.dscript session in order to reuse them for each application. Hence I wish to save them as a module at a path : <strong>C:\\Work\\modules\\myColor.py.<\/strong> In this class I have one method which seeks to call some Discovery API&lt;\/p&gt;<\/p>\n<pre>like <strong>part = GetRootPart().GetAllBodies()&lt;br&gt;&lt;span style=\"color: #ba372a;\"&gt;&gt; global name 'GetRootPart' is not defined&lt;\/span&gt;&lt;br&gt;<\/strong><\/pre>\n<p>&lt;p&gt;The trouble I am facing is that these APIs are not recognized as the class is saved in <strong>C:\\Work\\modules . <\/strong>I am unable to save it in<strong> <code>C:\\Program Files\\ANSYS Inc\\v251\\Discovery\\Library\\IronPython\\Lib<\/code> <\/strong>due to IT admin policy . What is the workaround here? I can prove that the module is successfully imported in the *.dscript as by using a&nbsp; simple print(&#8220;Hello&#8221;) command in the function of my module.&nbsp;&lt;\/p&gt;&lt;p&gt;Is there anything I could do to help this? I can upload a <em>.dscript and <\/em>.the *.py module&nbsp;&lt;\/p&gt;<\/p>\n","protected":false},"template":"","class_list":["post-453284","topic","type-topic","status-publish","hentry","topic-tag-python-ironpython-1","topic-tag-ansys-discovery"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_forum_id":["27789"],"_bbp_topic_id":["453284"],"_bbp_subscription":["650965","202"],"_bbp_author_ip":["134.204.180.68"],"_bbp_last_reply_id":["454597"],"_bbp_last_active_id":["454597"],"_bbp_last_active_time":["2026-03-16 13:02:46"],"_bbp_reply_count":["2"],"_bbp_reply_count_hidden":["0"],"_bbp_voice_count":["2"],"_bbp_engagement":["650965","202"],"_btv_view_count":["229"],"_bbp_topic_status":["unanswered"]},"test":"mihir-samelseagate-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/453284","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\/453284\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=453284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}