0
Unit_Test/
    __init__.py
widgets/
    __init__.py

In Unit_Test/__init__.py:

from .. widgets import PathPicker

I get the following error: ValueError: Attempted relative import in non-package

widgets/__init__.py has a class named PathPicker.

Edit: In regards to the comment below, I am running the script from pyCharm. I opened the project from the folder 'lib' in this directory: lib\pt_hil\utilities\PT_HIL_Interface_Utils\widgets

martineau
  • 119,623
  • 25
  • 170
  • 301
Slaknation
  • 2,124
  • 3
  • 23
  • 42
  • @ctj232 Yeah that does not work either. Same error – Slaknation Aug 02 '17 at 19:45
  • How are you running your `Unit_Test.__init__` module? If you're giving the file name on the command line, I'm not surprised that it doesn't work (since that imports it as `__main__` rather than its normal package name). – Blckknght Aug 02 '17 at 19:45
  • 2
    Suggest you read question [**_Relative imports for the billionth time_**](https://stackoverflow.com/questions/14132789/relative-imports-for-the-billionth-time). – martineau Aug 02 '17 at 19:48
  • @Blckknght check the edit – Slaknation Aug 02 '17 at 19:50

0 Answers0