Skip to content

Feat: How to do absolute imports #2

@davinci07

Description

@davinci07

This how to do absolute imports which will let you retrieve stuff like functions and classes from a parent module or a a different submodule.

sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

  • This basically says go find the absolute path, and then find the directory name that you want to look at, then append to the current running Python Path

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions