schema helpers BUGFIX searching typedefs in submodule
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index b402ce3..14572ce 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -259,6 +259,9 @@
         }
     }
 
+    /* go to main module if in submodule */
+    local_module = local_module->mod->parsed;
+
     /* search in top-level typedefs */
     if (local_module->typedefs) {
         LY_ARRAY_FOR(local_module->typedefs, u) {
@@ -270,7 +273,7 @@
         }
     }
 
-    /* search in submodules' typedefs */
+    /* search in all submodules' typedefs */
     LY_ARRAY_FOR(local_module->includes, u) {
         typedefs = local_module->includes[u].submodule->typedefs;
         LY_ARRAY_FOR(typedefs, v) {