Welcome to the forums. Please post in English or French.

You are not logged in.

#1 2019-03-11 10:32:14

chenghui62000
Member
From: Norway
Registered: 2018-06-19
Posts: 63

[SOLVED] How to import my own python module into .comm file

Dear everyone,

There is a question for the comm file. I have written a lot of python function and class to calculate the hydrodynamic forces of marine structures. Is there any way to use the "import" method to implement my own python module into the .comm file just like following.
(supposed my module located in "/home/hui/codeasterWorkspace/extralmodule/hydro.py")

 import numpy as np

Best regards,
Hui Cheng

Last edited by chenghui62000 (2019-03-11 16:33:02)

Offline

#2 2019-03-11 11:25:37

dbpatankar
Member
From: Roorkee, Uttarakhand, India
Registered: 2010-05-22
Posts: 171

Re: [SOLVED] How to import my own python module into .comm file

Hi,

Try this

import sys
sys.path.append("/home/hui/codeasterWorkspace/extralmodule")
import hydro as hd # or whatever

Offline

#3 2019-03-11 16:32:41

chenghui62000
Member
From: Norway
Registered: 2018-06-19
Posts: 63

Re: [SOLVED] How to import my own python module into .comm file

Thank you, dbpatankar. It works great!

Offline

Board footer