Skip to content

Commit

Permalink
Use import_module for commands import and instantiate
Browse files Browse the repository at this point in the history
  • Loading branch information
nickl- committed Dec 25, 2012
1 parent 0b9ba70 commit 538a468
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion aero/argument.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,8 @@ class CommandParser(_SubParsersAction):

def __call__(self, parser, data, values, option_string=None):
super(self.__class__, self).__call__(parser, data, values, option_string)
globals()[values[0].capitalize() + 'Command'](data).execute()
from importlib import import_module
getattr(
import_module('aero.commands.' + values[0]),
values[0].capitalize() + 'Command'
)(data).execute()

0 comments on commit 538a468

Please sign in to comment.