Python Forum
How to call a method in a module using code
Thread Rating:
  • 3 Vote(s) - 2.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to call a method in a module using code
#1
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?
Reply
#2
Is it this what you ask for? Check all 3 parts of the tutorial.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
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?
Reply
#4
importlib
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#5
Thanks a lot! This solved my problem :D
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  method call help sollarriiii 6 1,078 Feb-21-2023, 03:19 AM
Last Post: noisefloor
  How to run code again in module ? rajamani 2 863 Nov-10-2022, 02:38 PM
Last Post: snippsat
  how to get around recursive method call Skaperen 10 4,191 Jul-01-2020, 10:09 PM
Last Post: Skaperen
  module to store functions/variables and how to call them? mstichler 3 2,344 Jun-03-2020, 06:49 PM
Last Post: mstichler
  Import Module and Method ( dynamic ) ? JohnnyCoffee 0 1,492 Mar-23-2020, 04:23 PM
Last Post: JohnnyCoffee
  How to call COM-method using comtypes jespersahner 0 2,386 Nov-15-2019, 12:54 PM
Last Post: jespersahner
  Polymorphism not working with a call to a abstract method colt 3 2,276 Nov-04-2019, 11:04 PM
Last Post: colt
  How to Call a method of class having no argument dataplumber 7 6,318 Oct-31-2019, 01:52 PM
Last Post: dataplumber
  Call method from another method within a class anteboy65 3 7,348 Sep-11-2019, 08:40 PM
Last Post: Larz60+
  What is the use of call method and when to use it? everyday1 1 3,269 Jul-14-2019, 01:02 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020