Add a demo walk-through to the coder guide
[mudpy.git] / mudpy / __init__.py
1 """Core modules package for the mudpy engine."""
2
3 # Copyright (c) 2004-2018 mudpy authors. Permission to use, copy,
4 # modify, and distribute this software is granted under terms
5 # provided in the LICENSE file distributed with this software.
6
7 import importlib  # noqa (referenced via exec of string literal below)
8
9 import mudpy  # noqa (referenced via exec of string literal below)
10
11
12 def load():
13     """Import/reload some modules (be careful, as this can result in loops)."""
14
15     # pick up the modules list from this package
16     global modules
17
18     # iterate over the list of modules provided
19     for module in modules:
20
21         # attempt to reload the module, assuming it was probably imported
22         # earlier
23         try:
24             exec("importlib.reload(%s)" % module)
25
26         # must not have been, so import it now
27         except NameError:
28             exec("import mudpy.%s" % module)
29
30
31 # load the modules contained in this package
32 modules = ["command", "data", "misc", "password", "telnet", "version"]
33 load()