Skip to content

Commit 899fdc1

Browse files
committed
Fix script loading when using python > 3.12. find_module has been removed.
1 parent 066e873 commit 899fdc1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

netbox_script_manager/util.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import subprocess
66
import sys
77
import threading
8+
import importlib
89

910
from django.conf import settings
1011
from utilities.querydict import normalize_querydict
@@ -73,7 +74,9 @@ def load_scripts():
7374

7475
try:
7576
# Manually load the module
76-
module = importer.find_module(module_name).load_module(module_name)
77+
spec = importer.find_spec(module_name)
78+
module = importlib.util.module_from_spec(spec)
79+
spec.loader.exec_module(module)
7780
except Exception as e:
7881
failed_modules[module_name] = e
7982
logger.warning(f"Failed to load module {module_name}: {e}")

0 commit comments

Comments
 (0)