Skip to content

Commit

Permalink
better path update for utils import
Browse files Browse the repository at this point in the history
  • Loading branch information
MRColorR committed Jun 27, 2024
1 parent 9acf70b commit c4ff82b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion examples/fn_generic.py.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ from colorama import Fore, Back, Style, just_fix_windows_console
import sys
script_dir = os.path.dirname(os.path.abspath(__file__))
parent_dir = os.path.dirname(script_dir)
sys.path.append(parent_dir)
if parent_dir not in sys.path:
sys.path.append(parent_dir)
# Import the module from the parent directory
from utils import load, detect
from utils.cls import cls
Expand Down
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import sys
script_dir = os.path.dirname(os.path.abspath(__file__))
parent_dir = os.path.dirname(script_dir)
sys.path.append(parent_dir)
if parent_dir not in sys.path:
sys.path.append(parent_dir)
# Import the module from the parent directory
from utils import detector, loader
from utils.cls import cls
Expand Down
3 changes: 2 additions & 1 deletion utils/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import sys
script_dir = os.path.dirname(os.path.abspath(__file__))
parent_dir = os.path.dirname(script_dir)
sys.path.append(parent_dir)
if parent_dir not in sys.path:
sys.path.append(parent_dir)

# Import the module from the parent directory
from utils.loader import load_json_config
Expand Down
3 changes: 2 additions & 1 deletion utils/fn_show_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import sys
script_dir = os.path.dirname(os.path.abspath(__file__))
parent_dir = os.path.dirname(script_dir)
sys.path.append(parent_dir)
if parent_dir not in sys.path:
sys.path.append(parent_dir)
# Import the module from the parent directory
from utils.cls import cls
from utils.loader import load_json_config
Expand Down

0 comments on commit c4ff82b

Please sign in to comment.