Skip to content Skip to sidebar Skip to footer

Imports Not Found When Running Script Outside Of Pycharm?

I have a project structured this way... main.py imports scripts from subfolders like so: from controllers.available_balances_controller import available_balances_controller Subfol

Solution 1:

Try running your script with the -m flag:

$ python -m main

That means that you are running your main.py as a module inside a python package, not as a simple script. PyCharm makes it easy for you by assuming so when you create a project. When you are in the terminal, you need to specify it yourself. You don't need __init__.py files inside your directories in Python3.

Check out:


Post a Comment for "Imports Not Found When Running Script Outside Of Pycharm?"