04001a0f08011b739174293caed1d4a2d1b450f2
[mudpy.git] / lib / mudpy / __init__.py
1 # -*- coding: utf-8 -*-
2 """Core modules package for the mudpy engine."""
3
4 # Copyright (c) 2004-2013 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 import imp
9
10 import mudpy
11
12
13 def load():
14     """Import/reload some modules (be careful, as this can result in loops)."""
15
16     # pick up the modules list from this package
17     global modules
18
19     # iterate over the list of modules provided
20     for module in modules:
21
22         # attempt to reload the module, assuming it was probably imported
23         # earlier
24         try:
25             exec("imp.reload(%s)" % module)
26
27         # must not have been, so import it now
28         except NameError:
29             exec("import mudpy.%s" % module)
30
31 # load the modules contained in this package
32 modules = ["data", "misc", "password", "telnet"]
33 load()