mirror of
https://git.datalinker.icu/kijai/ComfyUI-Hunyuan3DWrapper.git
synced 2026-01-24 00:04:29 +08:00
Possible workaround for module import path on some configurations
This commit is contained in:
parent
48dae15e4a
commit
5e684d2334
@ -124,13 +124,15 @@ def export_to_trimesh(mesh_output):
|
||||
|
||||
|
||||
def get_obj_from_str(string, reload=False):
|
||||
package_directory_name = os.path.basename(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
|
||||
|
||||
module, cls = string.rsplit(".", 1)
|
||||
if reload:
|
||||
module_imp = importlib.import_module(module)
|
||||
importlib.reload(module_imp)
|
||||
return getattr(importlib.import_module(module, package=package_directory_name), cls)
|
||||
try:
|
||||
obj = getattr(importlib.import_module(module, package=os.path.basename(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))), cls)
|
||||
except:
|
||||
obj = getattr(importlib.import_module(module, package=os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath( __file__ ))))), cls)
|
||||
return obj
|
||||
|
||||
|
||||
def instantiate_from_config(config, **kwargs):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user