Skip to content

Commit

Permalink
0.14.3
Browse files Browse the repository at this point in the history
  • Loading branch information
EcmaXp committed Aug 10, 2024
1 parent 0b996fb commit ed872a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "reloader.py"
version = "0.14.2"
version = "0.14.3"
description = "A simple script reloader"
license = "MIT"
authors = ["EcmaXp <[email protected]>"]
Expand Down
6 changes: 5 additions & 1 deletion reloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from watchdog.utils.event_debouncer import EventDebouncer

__author__ = "EcmaXp"
__version__ = "0.14.2"
__version__ = "0.14.3"
__license__ = "MIT"
__url__ = "https://pypi.org/project/reloader.py/"
__all__ = [
Expand Down Expand Up @@ -374,6 +374,9 @@ def __init__(self, script_path: Path | PathLike):
super().__init__(module)
self.executed.clear()

def install_as_main_module(self):
sys.modules[self.name] = self.module

def run(self, *, with_main: bool = True):
self.reload(with_main=with_main)

Expand Down Expand Up @@ -499,6 +502,7 @@ def watch_module(self, module: ModuleType) -> CodeModule:

def watch_script(self, script_path: Path | PathLike) -> ScriptModule:
script_module = ScriptModule(script_path)
script_module.install_as_main_module()
self.watch_code_module(script_module)
return script_module

Expand Down

0 comments on commit ed872a1

Please sign in to comment.