About 592,000 results
Open links in new tab
  1. How do I call a function from another .py file? [duplicate]

    Note that file is one of Python's core modules, so I suggest you change the filename of file.py to something else. Note that if you're trying to import functions from a.py to a file called b.py, you …

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

    134 Another way: File test1.py: print "test1.py" File service.py: import subprocess subprocess.call("test1.py", shell=True) The advantage to this method is that you don't have to …

  3. How can I make one python file run another? - Stack Overflow

    How can I make one python file to run another? For example I have two .py files. I want one file to be run, and then have it run the other .py file.

  4. python - import a function from another .ipynb file - Stack Overflow

    May 22, 2017 · 82 I defined a hello world function in a file called 'functions.ipynb'. Now, I would like to import functions in another file by using "import functions". I am sure that they are in the …

  5. Calling a Python function from another file - Stack Overflow

    Aug 18, 2015 · 1 The python interpreter does not find your module "helpers". With what operating system do you work? When you are under Unix/Linux or similar, and your files are in the same …

  6. Calling __main__ from another file in python - Stack Overflow

    Nov 28, 2017 · I have another file named pool_manager.py and it has no class, it has one __main__ and lot of functions and basically, I want to call a method named generator of Client_simulator …

  7. python - importing functions from another jupyter notebook

    May 29, 2018 · The %run command tells the notebook to run the specified file and the -i option runs that file in the IPython namespace, which is not really meaningful in this simple example …

  8. How do I call a class method from another file in Python?

    Jul 30, 2017 · How do I call the printMessage(self) method from another file, example.py in the same directory? I thought this answer was close, but it shows how to call a class method from …

  9. python - Importing files from different folder - Stack Overflow

    If you run it from your root folder (ie. application folder), you are probably fine with sys.path.append('.') then importing the module by using from app2.some_folder.some_file …

  10. In Python, can I call the main () of an imported module?

    May 31, 2017 · In Python I have a module myModule.py where I define a few functions and a main (), which takes a few command line arguments. I usually call this main () from a bash script.