Scope of globals() limited to current module? #16447
Jibun-no-Kage
started this conversation in
General
Replies: 2 comments
-
I think you should be able to do something like: class Test:
def Testing(theMethod):
import main
main.theMethod() |
Beta Was this translation helpful? Give feedback.
0 replies
-
Ah! I will give that a shot... Thanks. What I did so, was just create a function pointer dictionary, Works, but not elegant at all. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Scope of globals() limited to current module? If I have a function or method name, and I want to call that method/function that happens to be defined in my 'main.py' file, but calling it is from a different module or class?
In main.py...
In class Test:
I have done this in regular method, but on micropython fails, looking at globals() it only shows method/functions in the current module. I guess I could pass in a list of method/function pointers to 'Testing' and then test if in that list, then call the method in turn, but I wondered if there as a way to avoid this list of method/function pointers?
Beta Was this translation helpful? Give feedback.
All reactions