bug fix in importing sfa method modules
[sfa.git] / sfa / util / api.py
index 3158851..1b86aae 100644 (file)
@@ -104,6 +104,7 @@ class BaseAPI:
         
         # flat list of method names
         methods_module = __import__(methods)
+        self.methods_module = methods_module
         self.methods = methods_module.methods.all
 
         # Better just be documenting the API
@@ -120,13 +121,6 @@ class BaseAPI:
         self.cert = Certificate(filename=self.cert_file)
         self.credential = None
         
-        # Initialize the PLC shell only if SFA wraps a myPLC
-        rspec_type = self.config.get_aggregate_rspec_type()
-        if (rspec_type == 'pl' or rspec_type == 'vini'):
-            self.plshell = self.getPLCShell()
-            self.plshell_version = self.getPLCShellVersion()
-
-        self.hrn = self.config.SFA_INTERFACE_HRN
         self.time_format = "%Y-%m-%d %H:%M:%S"
         self.logger=get_sfa_logger()
 
@@ -142,7 +136,7 @@ class BaseAPI:
         # Get new instance of method
         try:
             classname = method.split(".")[-1]
-            module = __import__("sfa.methods." + method, globals(), locals(), [classname])
+            module = __import__(self.methods_module.methods.__name__ + "." + method, globals(), locals(), [classname])
             callablemethod = getattr(module, classname)(self)
             return getattr(module, classname)(self)
         except ImportError, AttributeError: