use `nodes = []` instead of pass. `nodes` variable must be inizialized