Skip to content

Commit

Permalink
Do not reload plugins from disk
Browse files Browse the repository at this point in the history
Reloading from disk causes modules to be re-evaluated, and this is
often not desirable. This will break the ability to hot reload plugins
  • Loading branch information
delivrance committed Jul 17, 2020
1 parent 3f47de4 commit 2504286
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pyrogram/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import time
from configparser import ConfigParser
from hashlib import sha256, md5
from importlib import import_module, reload
from importlib import import_module
from pathlib import Path
from signal import signal, SIGINT, SIGTERM, SIGABRT
from threading import Thread
Expand Down Expand Up @@ -1523,7 +1523,7 @@ def load_plugins(self):
if not include:
for path in sorted(Path(root.replace(".", "/")).rglob("*.py")):
module_path = '.'.join(path.parent.parts + (path.stem,))
module = reload(import_module(module_path))
module = import_module(module_path)

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

try:
module = reload(import_module(module_path))
module = import_module(module_path)
except ImportError:
log.warning('[{}] [LOAD] Ignoring non-existent module "{}"'.format(
self.session_name, module_path))
Expand Down

0 comments on commit 2504286

Please sign in to comment.