diff --git a/src/treepuncher/__main__.py b/src/treepuncher/__main__.py index 4191d34..ffbad66 100644 --- a/src/treepuncher/__main__.py +++ b/src/treepuncher/__main__.py @@ -42,7 +42,7 @@ def main(): for addon in addons: help_text += f"\n {addon.__name__} \t{addon.__doc__ or ''}" - cfg_clazz = get_type_hints(addon)['config'] + cfg_clazz = get_type_hints(addon, globalns=globals())['config'] if cfg_clazz is ConfigObject: continue # it's the superclass type hint for field in fields(cfg_clazz): diff --git a/src/treepuncher/addon.py b/src/treepuncher/addon.py index fd10b23..e821b0c 100644 --- a/src/treepuncher/addon.py +++ b/src/treepuncher/addon.py @@ -58,7 +58,7 @@ class Addon: self.name = type(self).__name__ cfg = self._client.config opts: Dict[str, Any] = {} - cfg_clazz = get_type_hints(type(self))['config'] + cfg_clazz = get_type_hints(type(self), globalns=globals())['config'] if cfg_clazz is not ConfigObject: for field in fields(cfg_clazz): default = field.default if field.default is not MISSING \ diff --git a/src/treepuncher/treepuncher.py b/src/treepuncher/treepuncher.py index 9821e15..ddceb86 100644 --- a/src/treepuncher/treepuncher.py +++ b/src/treepuncher/treepuncher.py @@ -84,6 +84,8 @@ class Treepuncher( code= opt('code'), ) + super().__init__(opt('server', required=True), online_mode=online_mode, authenticator=authenticator) + self.storage = Storage(self.name) self.notifier = Notifier(self) @@ -95,8 +97,6 @@ class Treepuncher( logging.getLogger('apscheduler.executors.default').setLevel(logging.WARNING) # So it's way less spammy self.scheduler.start(paused=True) - super().__init__(opt('server', required=True), online_mode=online_mode, authenticator=authenticator) - prev = self.storage.system() # if this isn't 1st time, this won't be None. Load token from there state = SystemState(self.name, __VERSION__, 0) if prev: