Try using quotes: %attach 'misc.sage'. Without quotes, misc is interpreted as being a module within Sage -- for example, type just misc.sage from the sage: prompt.