Call a logic.customModule from another scene

Ok so as I was typing this I thought of a different way this could work that makes more sense, but for the sake of just doing it this way:

Edited: the reason I want to do it this way is so that my text object in the hud doesn’t store a ton of references to different text files depending on the message it receives
I want to do it this way so that the object the player touches stores what text file is to be read instead, which is more neat in my mind

I have a HUD Scene trying to communicate with the WORLDMAP Scene.

In the HUD scene, I have a text object that displays dialogue.
In the world map scene, the object that you go up and touch has the script that reads the dialogue from a txt file.
(I know I could just have the read-from-text script in the HUD scene, and have the object in the world map send a message, but bear with me)

In the text object in the HUD scene I have a line that says

logic.worldDialogue = own.children[0] # --- children refering to the text object which is parrented to an empty

I want the Worldmap scene to be able to refer to this logic.WorldDialogue.
Is there anyway to do this?

I realize I could just get the object from the scene, and use a message actuator to trigger its script, but yeah. Just curious if I can do what I am thinking there’s a way to do, which is just reference this logic.worldDialogue from another scene

This is the code for the script of the object in the WORLD map. the HUd object’s only line of script is the line i wrote above

PS: squall refers to a spell not ff8

def findSquall():
    try:
        currentLine = own['line']
        file = open(path+"LearnSquall.txt",'r')
        info = file.readlines()
        logic.worldDialogue.text = info[currentLine]
        own['line']+=1
    except:
        logic.worldDialogue.text = ""
        own.endObject()
    


for i in obj:
    if 'Player' in i:
        distance = own.getDistanceTo(i)
        if distance < 10:
            if confirmkey.positive:
                findSquall() 

Short version:

add a text block, name it “logic.py”. That’s a module named “logic”. In your scripts, add the line (usually the first one):

import logic

In all the scripts with the “import logic” line, “logic” is the same thing and you can use it to share states among scripts.