8e077f70c584fcaea96bff69f71afb7178e8206e
[mudpy.git] / lib / mudpy / __init__.py
1 # -*- coding: utf-8 -*-
2 """Core modules package for the mudpy engine."""
3
4 # Copyright (c) 2004-2012 Jeremy Stanley <fungi@yuggoth.org>. Permission
5 # to use, copy, modify, and distribute this software is granted under
6 # terms provided in the LICENSE file distributed with this software.
7
8
9 def load():
10     """Import/reload some modules (be careful, as this can result in loops)."""
11
12     # pick up the modules list from this package
13     global modules
14
15     # iterate over the list of modules provided
16     for module in modules:
17
18         # attempt to reload the module, assuming it was probably imported
19         # earlier
20         try:
21             exec("reload(%s)" % module)
22
23         # must not have been, so import it now
24         except NameError:
25             exec("import mudpy.%s" % module)
26
27 # load the modules contained in this package
28 modules = ["data", "misc", "password", "telnet"]
29 load()