I have a script I use to create groups, create new layers based off existing template hosted feature layers, set up a webmap, and share with my organization. I have been successfully using copy_feature_layer_collection, however I want to update my template hosted feature layer to have related tables. copy_feature_layer_collection technically should support that, but there's been a handful of threads showing there are bugs preventing it from working.
cloned_flyr = hosted_flyr.copy_feature_layer_collection('{} Observations'.format(project_number), layers = [0, 1, 2])
I've played around with clone_items, which should also work for this application, however it does nothing. I have entered it directly into the Python window in Pro and it and runs for a few seconds, then returns an empty list without an error. An empty hosted feature service is created in ArcGIS Online but absent of any layers.
cloned_flyr = gis.content.clone_items(items = [hosted_flyr], folder = '{}'.format(project_title) , copy_data = True, copy_global_ids = False, preserve_item_id = False)
Anything I'm missing here, or any other commands I should try? copy() seems to duplicate the item but still points to the original hosted feature layer URL, so that won't fit the bill.