Use writeable element in show element test
[mudpy.git] / mudpy / __init__.py
1 """Core modules package for the mudpy engine."""
2
3 # Copyright (c) 2004-2017 Jeremy Stanley <fungi@yuggoth.org>. Permission
4 # to use, copy, modify, and distribute this software is granted under
5 # terms provided in the LICENSE file distributed with this software.
6
7 import sys
8
9 import mudpy  # noqa (referenced via exec of string literal below)
10
11 if sys.version_info >= (3, 4):
12     import importlib  # noqa (referenced via exec of string literal below)
13 else:
14     # Python 3.3 lacks importlib.reload()
15     import imp as importlib  # noqa (referenced via exec of string literal)
16
17
18 def load():
19     """Import/reload some modules (be careful, as this can result in loops)."""
20
21     # pick up the modules list from this package
22     global modules
23
24     # iterate over the list of modules provided
25     for module in modules:
26
27         # attempt to reload the module, assuming it was probably imported
28         # earlier
29         try:
30             exec("importlib.reload(%s)" % module)
31
32         # must not have been, so import it now
33         except NameError:
34             exec("import mudpy.%s" % module)
35
36
37 # load the modules contained in this package
38 modules = ["data", "misc", "password", "telnet"]
39 load()