Hi, I know how to use the global variables when they are defined in a class, but I have a global variable in a main.
If I want to use it inside a class, which would be the import to access it?
My main is something like this
Main.py:
from EvolutionaryAlgorithm import EvolutionaryAlgorithm
initialTimeMain = 0
if __name__ == '__main__':
evolutionaryAlgorithm= EvolutionaryAlgorithm()
.
.
and my EvolutionaryAlgorithm class has a method which uses the initialTimeMain variable. the problem is when I add this import in the EvolutionaryAlgorithm:
EvolutionaryAlgorithm.py
import Main
because when I run the script, an error appears
from EvolutionaryAlgorithm import EvolutionaryAlgorithm ImportError: cannot import name EvolutionaryAlgorithm
the import isn't recognized anymore