From 02afd4b915c078b0bf67b02a61a0244e819facb4 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Wed, 6 Apr 2022 13:31:46 +0200 Subject: [PATCH] subfolder of module must have init file --- openpype/modules/base.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/openpype/modules/base.py b/openpype/modules/base.py index 2d5545d135..94aa8fca1b 100644 --- a/openpype/modules/base.py +++ b/openpype/modules/base.py @@ -304,7 +304,13 @@ def _load_modules(): fullpath = os.path.join(current_dir, filename) basename, ext = os.path.splitext(filename) - if not os.path.isdir(fullpath) and ext not in (".py", ): + if os.path.isdir(fullpath): + # Check existence of init fil + init_path = os.path.join(fullpath, "__init__.py") + if not os.path.exists(init_path): + continue + + elif ext not in (".py", ): continue try: @@ -342,7 +348,13 @@ def _load_modules(): fullpath = os.path.join(dirpath, filename) basename, ext = os.path.splitext(filename) - if not os.path.isdir(fullpath) and ext not in (".py", ): + if os.path.isdir(fullpath): + # Check existence of init fil + init_path = os.path.join(fullpath, "__init__.py") + if not os.path.exists(init_path): + continue + + elif ext not in (".py", ): continue # TODO add more logic how to define if folder is module or not