I'm trying to create variable with a certain function (see code below). When I run get_cloud()
and 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