Skip to content

Commit 2504286

Browse files
committed
Do not reload plugins from disk
Reloading from disk causes modules to be re-evaluated, and this is often not desirable. This will break the ability to hot reload plugins
1 parent 3f47de4 commit 2504286

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pyrogram/client/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import time
2828
from configparser import ConfigParser
2929
from hashlib import sha256, md5
30-
from importlib import import_module, reload
30+
from importlib import import_module
3131
from pathlib import Path
3232
from signal import signal, SIGINT, SIGTERM, SIGABRT
3333
from threading import Thread
@@ -1523,7 +1523,7 @@ def load_plugins(self):
15231523
if not include:
15241524
for path in sorted(Path(root.replace(".", "/")).rglob("*.py")):
15251525
module_path = '.'.join(path.parent.parts + (path.stem,))
1526-
module = reload(import_module(module_path))
1526+
module = import_module(module_path)
15271527

15281528
for name in vars(module).keys():
15291529
# noinspection PyBroadException
@@ -1545,7 +1545,7 @@ def load_plugins(self):
15451545
warn_non_existent_functions = True
15461546

15471547
try:
1548-
module = reload(import_module(module_path))
1548+
module = import_module(module_path)
15491549
except ImportError:
15501550
log.warning('[{}] [LOAD] Ignoring non-existent module "{}"'.format(
15511551
self.session_name, module_path))

0 commit comments

Comments
 (0)