doors/simulator/__init__.py
Anna Schumaker 3ef9283d6f simulator: Add a function for reloading the simulator
This lets me update the doors.py file without needing to exit the Python
interpreter.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-23 10:20:10 -04:00

28 lines
735 B
Python

import importlib
import os
import sys
#######################################################
# #
# Add simulator/ directory to the module search path. #
# #
#######################################################
sys.path.insert(0, os.path.join(os.getcwd(), "simulator"))
import doors
from doors import *
def reload_sim(namespace):
importlib.reload(GPIO)
importlib.reload(request)
importlib.reload(serial)
importlib.reload(doors)
namespace.update(doors.__dict__)
print("")
print("Welcome to the Workantile Door System Simulator!")
print("Hint: call reload() to reload the simulator with updated code.")