Using Linked Values In Server Scripts

Quoting from https://frappe.io/tutorial/naming-and-linking:

edit: https://frappe.io/docs/user/en/tutorial/naming-and-linking

Linked Values

A standard pattern is when you select an ID, say Library Member in Library Membership, then the Member’s first and last names should be copied into relevant fields in the Library Membership Transaction.

To do this, we can use Read Only fields and in options, we can set
the the name of the link and the fieldname of the property we want to
fetch. For this example in Member First Name we can set library_member.first_name

From my server scripts(and bench console) am creating a Library Membership using frappe.get_doc() method. However, the above highlighted behavior doesn’t seem to take effect.

Do linked values work as expected when creating records from server scripts? If not, what is the best practice of getting/implementing similar behavior in python server scripts?

Thanks,
Morris

Share your code / use case