It seems you forgot to import that function:
from pybrain.tools.shortcuts import buildNetwork
See documentation.
Each time you want to use a special member of a module, you have to import it. Look at the documentation and search the member. For example for TanhLayer. You see that the function is in pybrain.structure.modules
. So you have to import it like
from pybrain.structure.modules import TanhLayer
# or
from pybrain.structure.modules import *
There are other (sometimes cleaner) ways to import functions. This document from effbot explains nicely what are the differences and which you should use.