from math import *
It defines all the attributes without defining math. So we get this error.
import math from math import *
This imports the module as math but not that one.