So you want the GDL Object to know whether it is in the Project File itself or coming from a Hotlinked Module?
I looked through the GDL Reference Guide but I did not find any specific command for this.
There is a REQUEST command:
n = REQUEST ("Full_ID_of_parent", "", id_string)
For annotation elements linked or hotlinked on the floor plan, returns all identifiers (Master ID) of the linked modules and the parent library parts’ identifier set in the tool’s settings dialog box in the id_string variable (otherwise empty string). Expression returns 0 and contains dummy return values (emtpy string or 0) if used in parameter script, causing additional warning.
So this may be used somehow. For example, if the user always provides a Master ID to a Hotlinked Module when they are placed, then the Full ID of the GDL Object within the Hotlinked Module will be different from its Element ID (User ID). This difference could be checked and then the Pen of the GDL Object could be set in its 2D Script to change accordingly. This is in theory, I have not tried it, you would have to modify the 2D Script of the GDL Object.