I want to use `"img"` of `browse_file()` in `grey_scale()`. 
I am able to use `band_count(type Int)` but when I am trying to use `"img"` in `grey_scale()`, I'm getting the following error:

```
the type of "img" is class 'spectral.io.bilfile.BilFile'
Traceback (most recent call last):
File "main.py", line 50, in grey_scale
view = imshow(img,(bandGrey,))`
NameError: global name 'img' is not defined`

```

My code:

```
def browse_file(self,MainWindow):
    file = str(QtGui.QFileDialog.getOpenFileName(self,"Select Directory"))
    img = envi.open(file)       #load image to img object.
    band_info = str(img.read_band) 
    band_count = int((band_info.split(start))[1].split(end)[0])
    view = imshow(img,(1,0,0))

def grey_scale(self):
    bandGrey = self.spinBox_grey_band.value()
    print bandGrey      #working
    view = imshow(img,(bandGrey,))  #error 

```