Forum: Poser Python Scripting


Subject: Useful Code Snippets

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


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

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


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


(っ◔◑◔)っ

πŸ‘Ώ 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, Sequoia 15.5, 16GB, 500GB SSD
πŸ‘Ώ Nas 10TB
πŸ‘Ώ Poser 13 and 14 β€οΈ

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