I have a vm.py
in the same directory as the main()
script (getdata.py
). In getdata.py
, I have
import vm
...
x = vm.Something()
Then python complains
UnboundLocalError: local variable 'vm' referenced before assignment
Why is that? There was no error when importing.
UPDATE
I found that if I did
from vm import *
Instead it worked. Also for another file/module I made, a simple import
works. I uploaded the full code to GitHub Gist https://gist.github.com/2259298