main.py: replace deprecated imp module with importlib

This commit is contained in:
dymik739 2023-05-04 18:13:08 +03:00
parent a6284539ac
commit e4f0e88a58
2 changed files with 2 additions and 4 deletions

View File

@ -7,7 +7,6 @@ import sys
import os import os
import threading import threading
import importlib import importlib
import imp
# global variables # global variables
STOP_REQUESTED = False STOP_REQUESTED = False
@ -177,7 +176,7 @@ def queue_processor():
# properly reload all v2 modules # properly reload all v2 modules
for mod in mcu.modules: for mod in mcu.modules:
if mod.version == 2: if mod.version == 2:
imp.reload(mod.obj) importlib.reload(mod.obj)
del mcu.modules[:] del mcu.modules[:]
mcu.reload_modules() mcu.reload_modules()

View File

@ -6,7 +6,6 @@ import sys
import os import os
import threading import threading
import importlib import importlib
import imp
from telegram import Message, Chat from telegram import Message, Chat
@ -180,7 +179,7 @@ def queue_processor():
# properly reload all v2 modules # properly reload all v2 modules
for mod in mcu.modules: for mod in mcu.modules:
if mod.version == 2: if mod.version == 2:
imp.reload(mod.obj) importlib.reload(mod.obj)
del mcu.modules[:] del mcu.modules[:]
mcu.reload_modules() mcu.reload_modules()