It looks like you may have left out a crucial line from the script (Link) :
items = gis.content.get(itemid)
If gis is your target and gis2 is your source then it should be:
items = gis2.content.get(itemid)
Try the following:
from arcgis.gis import GIS
gis = GIS(<Put your URL here>) # Where it is going to
gis2 = GIS(<Put your URL here>) # Where it is coming from
itemid = '<Put your ID here>' # The item ID to clone
items = gis2.content.get(itemid)
def deep_copy_content(input_list):
for item in input_list:
try:
print("Cloning " + item.title)
copy_list = []
copy_list.append(item)
gis.content.clone_items(copy_list, copy_data=True, search_existing_items=True)
print("Successfully cloned " + item.title)
except Exception as e:
print(e)
print("The function has completed")
deep_copy_content(items)