I have an initial script that allows the user to build all the desired values for their playable character (I'm coding a retro RPG).
Next, I pass these values to a constructor which builds a character class, for example from charCreator script:
if buildButton.collidepoint(pos): player = playerCharacter(str(inputStringTemp),classNameString,lvl,(0,255,0)," ",vig,fin,met,awr,kno,cha, cnd,health,evasion,speed,ath,plt,rig,spc,dec,cyb,[""],[""]) import battleCode
Next, I import
combatCode.py, which which starts a combat event. From the other script, I do:
import sys import os import pygame import random from charCreator import player #Set display screen_size = [1280,700] screen = pygame.display.set_mode(screen_size) # Game Captions pygame.display.set_caption('Battle Code') #ect
When I execute the combat code script, the charCreator script launches. If I execute charCreator.py first, everything works , except that the charCreator script keeps running even after I've imported the combat script.
Why is this happening? is there a better way to pass variables built from other scripts? What are my options if all I need is the constructed player variable once it's built?