Commits

Brandon Rhodes committed 2a2f2b5

Moved __init__.py imports into functions to reduce side effects of import.

Comments (0)

Files changed (1)

adventure/__init__.py

 """The Adventure game."""
 
-import os
-from .data import parse
-from .game import Game
-from .prompt import install_builtins
+def load_advent_dat(data):
+    import os
+    from .data import parse
 
-def load_advent_dat(data):
     datapath = os.path.join(os.path.dirname(__file__), 'advent.dat')
     with open(datapath, 'r', encoding='ascii') as datafile:
         parse(data, datafile)
     """
     global _game
 
+    from .game import Game
+    from .prompt import install_builtins
+
     _game = Game(seed)
     load_advent_dat(_game)
     install_builtins(_game)
 def resume(savefile, quiet=False):
     global _game
 
+    from .game import Game
+    from .prompt import install_builtins
+
     _game = Game.resume(savefile)
     install_builtins(_game)
     if not quiet: