About 909,000 results
Open links in new tab
  1. How to import a class from another file in python?

    Nov 25, 2020 · Im new to python and have looked at various stack overflow posts. i feel like this should work but it doesnt. How do you import a class from another file in python? This folder …

  2. python - Importing class from another file - Stack Overflow

    Dec 22, 2016 · Before you mark it as duplicate please read my problem: I am trying to import a class from a file from a subdirectory > main.py > --->folder/ > ----->file.py and in file.py i have a

  3. python - How to import the class within the same directory or sub ...

    Jan 26, 2017 · Because that's how Python identifies directories from which you're allowed to import. The directory of the script you're running is an exception - you're always allowed to …

  4. 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 …

  5. python - How to inherit class from different file? - Stack Overflow

    Oct 25, 2016 · This is because you either have to tell python the namespace through which it can access the class (my first solution) or explicitly import the class (my second solution).

  6. How to import a Python class that is in a directory above?

    Jun 28, 2009 · I want to inherit from a class in a file that lies in a directory above the current one. Is it possible to relatively import that file?

  7. How do I import other Python files? - Stack Overflow

    How do I import files in Python? I want to import: a file (e.g. file.py) a folder a file dynamically at runtime, based on user input one specific part of a file (e.g. a single function)

  8. python - Importing a function from a class in another file? - Stack ...

    I'm writing a Python program for fun but got stuck trying to import a function from a class in another file. Here is my code: #jurassic park mainframe from random import randint from sys …

  9. How to dynamically load a Python class - Stack Overflow

    Feb 14, 2009 · 252 Given a string of a Python class, e.g. my_package.my_module.MyClass, what is the best possible way to load it? In other words I am looking for a equivalent …

  10. Global Variable from a different file Python - Stack Overflow

    By the way, as a general principle, it's not really recommended to do from module import * because it makes it hard to see where any given imported variable comes from. Also, don't …