@@ -36,6 +36,7 @@ def __init__(
3636 self .module = None
3737 self .rel_import_path = rel_import_path
3838 self .source = source
39+ self .file_path = None
3940 self .mtime = mtime
4041 self .app_config = app_config
4142 self .imports = set ()
@@ -97,6 +98,10 @@ def get_mtime(self):
9798 """Return the mtime."""
9899 return self .mtime
99100
101+ def get_file_path (self ):
102+ """Return the file path."""
103+ return self .file_path
104+
100105 def get_imports (self ):
101106 """Return the imports."""
102107 return self .imports
@@ -287,7 +292,7 @@ def new_name(cls, root):
287292 return name
288293
289294 @classmethod
290- async def load_file (cls , global_ctx , file_path , source = None , force = False ):
295+ async def load_file (cls , global_ctx , file_path , source = None , reload = False ):
291296 """Load, parse and run the given script file; returns error ast_ctx on error, or None if ok."""
292297
293298 mtime = None
@@ -331,10 +336,11 @@ def read_file(path):
331336 global_ctx .stop ()
332337 return False , ast_ctx
333338 global_ctx .source = source
339+ global_ctx .file_path = file_path
334340 if mtime is not None :
335341 global_ctx .mtime = mtime
336342 cls .set (global_ctx .get_name (), global_ctx )
337343
338- _LOGGER .info ("Loaded %s" , file_path )
344+ _LOGGER .info ("%s %s" , "Reloaded" if reload else "Loaded " , file_path )
339345
340346 return True , None
0 commit comments