How to call a method in a module using code - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How to call a method in a module using code (/thread-15375.html) |
How to call a method in a module using code - KingPieter - Jan-15-2019 Hello everyone I've question concerning calling methods just using code. The general idea is that I can give a name of a module and a method in that module so the code will recognize it and run it. Is there a way of doing such a thing? RE: How to call a method in a module using code - buran - Jan-15-2019 Is it this what you ask for? Check all 3 parts of the tutorial. RE: How to call a method in a module using code - KingPieter - Jan-15-2019 First of all, thanks for the response Yes this solves my question but only partly. I know how to import modules by name and calling methods by doing so but the only problem is that I'm passing through the module name using an argument. Is there a way to import the module by using a parameter as the module name? RE: How to call a method in a module using code - buran - Jan-15-2019 importlib RE: How to call a method in a module using code - KingPieter - Jan-15-2019 Thanks a lot! This solved my problem :D |