I'm trying to create variable with a certain function (see code below). When I run
print cloud from the console, it says:
NameError: name 'cloud' is not defined
When I run the for loop outside the function, it works just fine.
def get_cloud(): for layer in iface.legendInterface().layers(): if "cloud" in layer.name(): cloud = layer else: pass