Get and set family parameters; expected reference, got family symbol

Im trying to get and set family parameters through the revit api. I know its possible with dynamo, but Im trying to get a better understanding of the API. So Im trying to do it directly with the api codes.
Im getting the error: expected reference, got family symbol in line 41.
Maybe someone has an idea whats going wrong.
Below is my code so far.

Hello @wouter.hilhorst
at line 40
try to replace
T = doc.GetElement(Family[0]).GetTypeId()
T = doc.GetElement(Family[0].GetTypeId())

Many thanks for your help! Your solution solved the problem!