Skip to main content
Second iteration.
Source Link
Peter Mortensen
  • 31.6k
  • 22
  • 110
  • 133

Just do simple things to import the .py file from a different folder.

Let's say you have a directory like:

lib/abc.py

Then just keep aan empty file in lib folder as named

__init__.py

And then use

from lib.abc import <Your Module name>

Keep the __init__.py file in every folder of the hierarchy of the import module.

Just do simple things to import the .py file from a different folder.

Let's you have a directory like:

lib/abc.py

Then just keep a empty file in lib folder as named

__init__.py

And then use

from lib.abc import <Your Module name>

Keep the __init__.py file in every folder of the hierarchy of the import module.

Just do simple things to import the .py file from a different folder.

Let's say you have a directory like:

lib/abc.py

Then just keep an empty file in lib folder as named

__init__.py

And then use

from lib.abc import <Your Module name>

Keep the __init__.py file in every folder of the hierarchy of the import module.

Active reading.
Source Link
Peter Mortensen
  • 31.6k
  • 22
  • 110
  • 133

Just do Simple Thingssimple things to import pythe .py file from a different folder-.

Let's you have a directory like-:

lib/abc.py

Then just keep a empty file in lib folder as named

__init__.py

andAnd then use

from lib.abc import <Your Module name>

Keep the __init__.py file in every folder of the hierarchy of the import module.

Just do Simple Things to import py file from different folder-

Let's you have a directory like-

lib/abc.py

Then just keep a empty file in lib folder as named

__init__.py

and then use

from lib.abc import <Your Module name>

Keep __init__.py file in every folder of hierarchy of import module

Just do simple things to import the .py file from a different folder.

Let's you have a directory like:

lib/abc.py

Then just keep a empty file in lib folder as named

__init__.py

And then use

from lib.abc import <Your Module name>

Keep the __init__.py file in every folder of the hierarchy of the import module.

added 69 characters in body
Source Link

Just do Simple Things to import py file from different folder-

Let's you have a directory like-

lib/abc.py

Then just keep a empty file in lib folder as named

__init__.py

and then use

from lib.abc import <Your Module name>

Keep __init__.py file in every folder of hierarchy of import module

Just do Simple Things to import py file from different folder-

Let's you have a directory like-

lib/abc.py

Then just keep a empty file in lib folder as named

__init__.py

and then use

from lib.abc import <Your Module name>

Just do Simple Things to import py file from different folder-

Let's you have a directory like-

lib/abc.py

Then just keep a empty file in lib folder as named

__init__.py

and then use

from lib.abc import <Your Module name>

Keep __init__.py file in every folder of hierarchy of import module

Source Link
Loading