As I understand it the hypeDocument is not fully loaded when scripts run in the "Head HTML" so You will not be able to access timelines with Hype's API at that point.
Also, as I understand things (i.e. read about them - not actually experimented) You are facing an issue with iFrame > Parent communications... where the recommended practice is postMessage().
Please see this thread for the discussion - it might prove illuminating in solving your issue:
Here is an example Hype project from that thread (near bottom) posted by @jangeltun:
iFrame communication.zip (220.9 KB)