Hello,
I have created a model which iterates through some feature layers, makes a select by location, and exports the selected features into a folder as shapefiles.
I have also created a second model which is in theory supposed to run the model above, and then iterate through the the shapefiles and add a new field to each featureclass.
At present, my model does not run the former model, and I do not understand how to edit the python code so that I can run both models sequentially.
I have attached screenshots of the former model (Model4) and latter model (Model3), and the python code exported from the latter model.
Model4:

Model3:

Python Export:
# -*- coding: utf-8 -*-
"""
Generated by ArcGIS ModelBuilder on : 2022-05-10 18:24:07
"""
import arcpy
import os
from Default.Model4 import Model4
from sys import argv
def FeatureClassGenerator(workspace, wild_card, feature_type, recursive) :
with arcpy.EnvManager(workspace = workspace):
dataset_list = [""]
if recursive:
datasets = arcpy.ListDatasets()
dataset_list.extend(datasets)
for dataset in dataset_list:
featureclasses = arcpy.ListFeatureClasses(wild_card, feature_type, dataset)
for fc in featureclasses:
yield os.path.join(workspace, dataset, fc), fc
def Model3(test_poly="test_poly"): # Model 3
# To allow overwriting outputs change overwriteOutput option to True.
arcpy.env.overwriteOutput = False
Model_Variables = "C:\\Users\\Scar\\Documents\\landCharges\\landCharges\\Model_Variables"
for AssetsCV_shp, Name in FeatureClassGenerator(Model_Variables, "", "", "NOT_RECURSIVE"):
# Process: Add Field (Add Field) (management)
AssetsCV_shp_2_ = arcpy.management.AddField(in_table=AssetsCV_shp, field_name="Reference", field_type="TEXT", field_precision=None, field_scale=None, field_length=100, field_alias="", field_is_nullable="NULLABLE", field_is_required="NON_REQUIRED", field_domain="")[0]
# Process: Model 4 (Model 4) (Default)
Model4(test_poly=test_poly)
if __name__ == '__main__':
# Global Environment settings
with arcpy.EnvManager(outputCoordinateSystem="PROJCS["British_National_Grid",GEOGCS["GCS_OSGB_1936",DATUM["D_OSGB_1936",SPHEROID["Airy_1830",6377563.396,299.3249646]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",400000.0],PARAMETER["False_Northing",-100000.0],PARAMETER["Central_Meridian",-2.0],PARAMETER["Scale_Factor",0.9996012717],PARAMETER["Latitude_Of_Origin",49.0],UNIT["Meter",1.0]]", scratchWorkspace=r"C:\Users\Scar\Documents\landCharges\landCharges\Default.gdb", workspace=r"C:\Users\Scar\Documents\landCharges\landCharges\Default.gdb"):
Model3(*argv[1:])
From what I understand from the python code, Model4 is being imported, but is not being called.I've had a look at the documentation for arcpy.EnvManager, but I haven't found any info on how an imported model is called as an argument within another.
Any help is much appreciated.