Forum: Poser Python Scripting


Subject: Useful Code Snippets

structure opened this issue on Jun 27, 2019 ยท 94 posts


structure posted Sat, 26 February 2022 at 8:04 AM Forum Coordinator

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)


Locked Out