def recursive_dir(self, path, tree_root): path_name = os.path.basename(path) #tree[path_name] ={} #tree_root = self.parent.tree_root for f in sorted(os.listdir(path)): full_path = os.path.join(path, f) if os.path.isdir( full_path) and not self.is_asset_folder(full_path): temp_root = QTreeWidgetItem(tree_root, [f.title().replace('_', ' '), f]) temp_root.full_path = full_path self.recursive_dir(full_path, temp_root)