Or simply remove all arguments in the function's definition. Then declare treeModel as global only if you need to assign it inside the function.