I have developed a script tool for adding a layer in the current map document. It did not work.. The message is "Completed script addlayer...". But there were no layers added in the TOC. Another issue is when i type the same script in the python console window within Arcmap, the layer gets added. After adding the layer through console window, when i execute the script tool, it works and the layer gets added. I don't know what is the problem... pls help.. this is my script..
import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "*")[0]
addLayer = arcpy.mapping.Layer(r"D:\Academic\M.E_thesis\data\ascii files\maxent\soil.lyr")
arcpy.mapping.AddLayer(df, addLayer, "BOTTOM")