I'm trying to add a .pyt toolbox file to the ArcToolbox. When browsing to the .pyt file to add it, it has a red x on the icon. Once selected and Opened, it won't add the toolbox/tools to the ArcToolbox list. It added fine last week.
Using the ArcMap Catalog window (or ArcCatalog itself), browse to the offending pyt (don't use the ArcToolbox -> Add Toolbox dialog for this test).
Does the toolbox have the "X" or the tools inside?
i.e
If it's the toolbox (pyt) - right click on the .pyt and select "Check syntax...".
If it's the tool - right click on the tool and select "Why...".
Post the output (as text, not screenshot).
I also have this question when trying to add my Python Toolbox to ArcMap. ArcMap is using Python 2.x, so that it's a bit different from ArcGIS Pro and there is also some strict limit. I finally fixed this issue by checking two aspects: Syntax and Encoding.
1. Syntax Errors
Please make sure there are no syntax errors before adding to ArcMap.
2. Encoding
Please make sure the encoding of your *.pyt is correct (Python 2.x needs you to define the encoding). You can use all English characters or adding an encoding at the header of the file.
Hello
Finally how you have add it can you please explain