diff --git a/meta/recipes-devtools/python/python3/get_module_deps3.py b/meta/recipes-devtools/python/python3/get_module_deps3.py
index f26d9b20b4b..08c2d28feb7 100644
--- a/meta/recipes-devtools/python/python3/get_module_deps3.py
+++ b/meta/recipes-devtools/python/python3/get_module_deps3.py
@@ -50,11 +50,15 @@ def fix_path(dep_path):
 
 # Module to import was passed as an argument
 current_module =  str(sys.argv[1]).rstrip()
+
 if debug == True:
     log = open('temp/log_%s' % current_module.strip('.*'),'w')
     log.write('Module %s generated the following dependencies:\n' % current_module)
 try:
+    real_stdout = sys.stdout
+    sys.stdout = None
     m = importlib.import_module(current_module)
+
     # handle python packages which may not include all modules in the __init__
     if hasattr(m, '__file__') and os.path.basename(m.__file__) == "__init__.py":
         modulepath = os.path.dirname(m.__file__)
@@ -70,6 +74,8 @@ except ImportError as e:
     if debug == True:
         log.write('Module was not found\n')
     pass
+finally:
+    sys.stdout = real_stdout
 
 
 # Get current module dependencies, dif will contain a list of specific deps for this module
