I have the following script:
import arcpy
from arcpy import mapping
arcpy.env.workspace = r"C:\GIS\Test"
mxd = arcpy.mapping.MapDocument(r"C:\GIS\Test\Mxd_to_shape.mxd")
df = arcpy.mapping.ListDataFrames(mxd)[0]
#Variables
shp_input = "hellow.shp"
layer_output = "test"
arcpy.MakeFeatureLayer_management(shp_input,layer_output)
layer = arcpy.mapping.Layer(layer_output)
arcpy.mapping.AddLayer(df,layer,"AUTO_ARRANGE")
mxd.saveACopy(r"C:\GIS\Test\Mxd_a_shape2.mxd")
del mxd
arcpy.AddMessage("Ended process")
As you can see, I have defined variables in the previous script. However, I need these variables to remain "open" to later transform the script into a sub-tool of a ModelBuilder model. The need is that apparently having the pre-set variables in the script, wanting to change them as parameters in ModelBuilder does not work.