Spectral survey with USRP and GRC


I am trying to make a simple spectral survey with a USRP and GRC. I want
to create a flowgraph that runs for a fixed number of iterations. In
each iteration, I need to set a new center frequency in the uhd source,
read data from the uhd source, run fft on it, and write results to a

I have two problems I don’t know how to solve. The first one is how to
run a grc flowgraph for a fixed number of iterations. The second one,
which looks harder to me, is how to change the center frequency in the
uhd source between iterations. This would be easy if the center
frequency could be passed through an input port. I’ve done something
like this many times in Labview. However, the center frequency can only
be set as a variable in the uhd source.

Can this be done in grc or do I have to create the top level graph in
Python or C++ to be able to reconfigure it after every iteration?