Whenever a tool is executed in a script, an ArcGIS license is required. Tools from ArcGIS extensions, such as the ArcGIS Spatial Analyst extension, require an additional license for that extension. If the necessary licenses are not available, a tool fails and returns error messages. For example, if you install with a Desktop Basic license, and you attempt to execute a tool that requires a Desktop Standard or Desktop Advanced license, the tool fails.
Every tool checks to ensure it has the appropriate license. If it doesn't have what's required, it fails. To guard against the situation of executing partially through and failing, you can perform a check at the top of your script and fail immediately. The CheckExtension function can be used to evaluate if you are licensed for a particular extension, and the CheckProduct function can be used to evaluate if you are licensed for a particular product level.
The ArcGIS Pro application is part of ArcGIS Desktop, which has three levels—Desktop Basic, Desktop Standard, and Desktop Advanced—with each level providing additional functionality. Only ArcGIS Pro uses licensing through the organization. Other ArcGIS Desktop applications—ArcMap, ArcCatalog, ArcGlobe, and ArcScene—use the local ArcGIS Administrator application to set levels and extensions.
For more information on licensing in ArcGIS Pro, see Licensing ArcGIS Pro.