Skip to content

Commit

Permalink
adding support for loading files into the current scope
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mrojas committed Sep 27, 2024
1 parent 7d5f412 commit dda6b50
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions extras/sfutils/sfutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ def text_input(self, labelOrName,value=None,key=None):
return value
st = StreamlitMock()

import importlib
import inspect

def run(module_name):
"""
Loads all the module elements into the current scope
"""
caller_globals = inspect.currentframe().f_back.f_globals
module = importlib.import_module(module_name)
caller_globals.update({k: v for k, v in module.__dict__.items() if not k.startswith('_')})


class WidgetUtils:
def __init__(self):
Expand Down

0 comments on commit dda6b50

Please sign in to comment.