Similar issue to
MakeFeatureLayer_management does not add layer to TOC? (which I even had answer to) and
https://community.esri.com/message/416673#comment-416673
I have tried many incarnations of the Make Feature Layer options from those two threads. My tool works fine if I copy/past in the ArcMap python window, but when I run from the tool, my final result is an empty table (but with all the fields I added). No Error. I also successfully use the MakeFeatureLayer command in this same tools, but those are coming from feature classes, not PointGeometry.
When I traced it backwards, with many print statements, the difference seems to be that my FeatureLayer created from my PointGeometry is empty when running from the tool...but a count of one (as it should be) when running in the python window.
# all the necessary variables are valid
ptGeom = arcpy.PointGeometry(arcpy.Point(ptX, ptY, 0, 0, ptid))
arcpy.MakeFeatureLayer_management(ptGeom, "origPtFL")
resultCountPT = int(arcpy.GetCount_management("origPtFL").getOutput(0))
print("\n {}: {} recs".format("origPtFL", resultCountPT))
This is a snippet from a longer tool that wouldn't be practical to include, but all the variables, etcs are assigned. but since the count for "origPtFL" is now zerow, when I get down to
arcpy.SelectLayerByLocation_management(tmpContourFL, nearType, "origPtFL", nearDist)"
the results perpetual zero records.
BTW - the ptX, ptY values are coming thru fields in a table in a searchcursor. I know this isn't enough to be able to recreate the process, and I don't expect anyone to create a tool just to test this, but hoping someone else has a workable solution to this. BTW - I have put in a support ticket, but haven't heard anything from them yet.