Edit: I was having issues getting a function to take parameters as well as the decorator factory. I have sort of gotten it to work but now the test_func() wants a parameter but giving it one is useless, so I assume this is terrible practice. def factory(sub_url, **kwargs): def decorator(func): @functools.wraps(func) def wrapper_func(*args, **kwargs): # Inner Function full_link = URL + sub_url del kwargs # do something with these return func(full_link) return wrapper_func return decorator @factory(suburl, headers=headers) def test_func(output): print(f'Output: {output}') return "1234" print(test_func()) I guess this would do: @factory(suburl, headers=headers) def test_func(*args): print(f'Output: {args[0]}') return "1234"
@rajat0610