It is hard to know how you are defining it, under what conditions it will be defined, etc. But with the very little information provided, maybe this will help?
Sorry, I should have been far clearer: The kinds of variables I want to be able to (optionally) use are the ones I pull via var(), not local jinja variables.