I'm attempting to run a simple tool script in ArcGIS Pro 2.4 that creates a feature layer from an existing layer. The script creates the feature layer just fine if running the script in PyCharm, as well as the Python interpreter within ArcGIS (adds visible feature layer under Maps).
Why would the layer not be created and be visible in ArcGIS pro if running the script as a tool, compared to running it externally or in the interpreter?
Anyone else having this issue with 2.4 when running scripts as a tool?
No errors.
p = arcpy.mp.ArcGISProject("CURRENT")
a_map = p.activeMap
lyrs = a_map.listLayers()
# Checking layers within activeMap, they exist
for l in lyrs:
arcpy.AddMessage("{0}: activeMap layer: ".format(l))
# Feature layer not created when used as a tool, but works in the Python interpreter & external PyCharm run
arcpy.MakeFeatureLayer_management(a_map.listLayers('countries')[0], 'test')