Forum: Poser Python Scripting


Subject: Useful Code Snippets

structure opened this issue on Jun 27, 2019 Β· 94 posts


Y-Phil posted Sat, 26 February 2022 at 11:15 AM

structure posted at 8:04 AM Sat, 26 February 2022 - #4435181

Y-Phil posted at 12:46 PM Wed, 29 December 2021 - #4432576

I don't know if this can help someone, but just in case...
These last months, I've been writing a toolbox with a few wxpython script to import, as the main script has more than 1100 lines. The problem with python is that once a module is imported, it remains in memory, and I've been searching a way to pop it out if there's an error in it, hence this method (I'm writing for Poser12):

import sys

try: sys.modules.pop('my_module')
except: pass
from my_module import MyClass

nice, there is also another method : 


import importlib
import module
importlib.reload(module)


Well... Thank you for that nice trick! 😁

π’«π’½π“Žπ“


(っ◔◑◔)っ

πŸ‘Ώ Win11 on i9-13900K@5GHz, 64GB, RoG Strix B760F Gaming, Asus Tuf Gaming RTX 4070 OC Edition, 1+2 TB SSD's, 6+4TB HD
πŸ‘Ώ Mac Mini M2, Tahoe 26.5, 16GB, 500GB SSD
πŸ‘Ώ Nas 10TB
πŸ‘Ώ Poser 13 and 14 β€οΈ

π‘€π“Ž π’’π’Άπ“π“π‘’π“‡π“Ž