{"id":822,"date":"2024-06-05T14:58:15","date_gmt":"2024-06-05T21:58:15","guid":{"rendered":"http:\/\/fx-td.com\/houdiniandchill\/?p=822"},"modified":"2024-06-05T15:08:45","modified_gmt":"2024-06-05T22:08:45","slug":"archived-post-by-kiran_irugalbandara-2","status":"publish","type":"post","link":"http:\/\/fx-td.com\/houdiniandchill\/2024\/06\/05\/archived-post-by-kiran_irugalbandara-2\/","title":{"rendered":"Archived post by kiran_irugalbandara"},"content":{"rendered":"<div class=\"postie-post\">\n<p class=\"\">@David Torno I got fed-up of writing that code to the shell . you can make your own MainMenuCommon.xml file which will give you a section on the top menu bar. Then you can add a custom button to that which runs a script which handles this reload. so much easier. atleast imo.<\/p>\n<p class=\"\">this is what my code , looks like. It just reloads all my modules in my scripts folder<\/p>\n<p class=\"\">&#8220;`xml <?xml version=\"1.0\" encoding=\"UTF-8\"?><br \/>\n<mainmenu>     <menubar>         <submenu id=\"PJTools_Menu\">             <label>PJTools<\/label>             <insertbefore>help_menu<\/insertbefore><br \/>\n            <scriptitem id=\"Reload_PJTools_Modules\">                 <label>Reload PJTools Modules<\/label>                 <scriptcode><![CDATA[ import importlib import os\n#list files in PJTOOLS directory tool_directory = os.getenv(\"PJTOOLS\") + \"\/scripts\/shelftools\/\" files_in_directory = os.listdir(tool_directory)\n#filter only py scripts scripts = [file for file in files_in_directory if file.endswith(\".py\")]\n#Reload each module for file in scripts:     script_name = file.split(\".\")[0]     try:         module = importlib.import_module(f\"shelftools.{script_name}\")         importlib.reload(module)         print(f\"Reloaded module : {script_name}\")     except ImportError:         print(f\"Error reloading module: {script_name}\")                 ]]><\/scriptcode>             <\/scriptitem>             <separatoritem \/>         <\/submenu>     <\/menubar> <\/mainmenu>&#8220;`<\/p>\n<p>Attachments in this post: <br \/><a href=\"http:\/\/fx-td.com\/houdiniandchill\/wp-content\/uploads\/discord\/20245806\/05\/24\/image.png\">http:\/\/fx-td.com\/houdiniandchill\/wp-content\/uploads\/discord\/20245806\/05\/24\/image.png<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>@David Torno I got fed-up of writing that code to the shell . you can make your own MainMenuCommon.xml file which will give you a section on the top menu bar. Then you can add a custom button to that which runs a script which handles this reload. so much easier. atleast imo. this is &hellip; <a href=\"http:\/\/fx-td.com\/houdiniandchill\/2024\/06\/05\/archived-post-by-kiran_irugalbandara-2\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Archived post by kiran_irugalbandara<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/posts\/822"}],"collection":[{"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/comments?post=822"}],"version-history":[{"count":0,"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/posts\/822\/revisions"}],"wp:attachment":[{"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/media?parent=822"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/categories?post=822"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/tags?post=822"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}