Nevermind, I figured it out right after I clicked the send button :\ from my_paths import * def get_selected_paths(): return [globals()[s] for s in ["home", "desktop", "project1", "project2"] if s in globals()]