Not sure why you can't just have search take input as an argument search(input). Maybe I'm wrong, but I don't think input needs to exist outside of search.