About 340,000 results
Open links in new tab
  1. python - How do you call a function in a function? - Stack Overflow

    2 2 way to use a function within an other: You define the square() function in another .py file (ex: myfile.py) and then, you can import the function this way: from myfile import square def …

  2. python - How to call a script from another script? - Stack Overflow

    From the Python documentation: The subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using …

  3. calling a function from class in python - different way

    I have dropped the init function this time. class MathsOperations: def testAddition (x, y): return x + y def testMultiplication (a, b): return a * b calling this using; from testClass import …

  4. python - Calling a function of a module by using its name (a string ...

    Jun 4, 2022 · I've got a reason for you (actually what led me here): Module A has a function F that needs to call a function by name. Module B imports Module A, and invokes function F with a …

  5. Python __call__ special method practical example

    Apr 29, 2011 · 0 The function call operator. class Foo: def __call__(self, a, b, c): # do something x = Foo() x(1, 2, 3) The __call__ method can be used to redefined/re-initialize the same object. …

  6. python - How can I call a function within a class? - Stack Overflow

    I have this code which calculates the distance between two coordinates. The two functions are both within the same class. However, how do I call the function distToPoint in the function …

  7. How to call a async function from a synchronized code Python

    Aug 9, 2018 · So I'm locked to a python 3.6.2 interpreter that follows my desktop application. What I want is to call an async function from a synchronized method or function. When calling …

  8. python - Timeout on a function call - Stack Overflow

    Jan 30, 2009 · I'm calling a function in Python which I know may stall and force me to restart the script. How do I call the function or what do I wrap it in so that if it takes longer than 5 seconds …

  9. What is the difference between __init__ and __call__?

    Mar 12, 2012 · I think __new__ creates the class instance and receive a class as argument, whereas __init__ is the instance constructor which is why it receives self. An easy way to see …

  10. How do I call a function from another .py file? [duplicate]

    First, import function from file.py: from file import function Later, call the function using: function(a, b) Note that file is one of Python's core modules, so I suggest you change the filename of …

Refresh